[PATCH] staging/lustre/lnet: Fix allocation size for sv_cpt_data
This is unbreaking another of those "stealth" janitor patches that got in and subtly broke some things. sv_cpt_data is a pointer to pointer, so need to dereference it twice to allocate the correct structure size. Fixes: 9899cb68c6c23d58b27035c237b2d425f4c6133c CC: Sandhya Bankar Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/selftest/rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/selftest/rpc.c b/drivers/staging/lustre/lnet/selftest/rpc.c index 92cd411..87fe366 100644 --- a/drivers/staging/lustre/lnet/selftest/rpc.c +++ b/drivers/staging/lustre/lnet/selftest/rpc.c @@ -255,7 +255,7 @@ srpc_service_init(struct srpc_service *svc) svc->sv_shuttingdown = 0; svc->sv_cpt_data = cfs_percpt_alloc(lnet_cpt_table(), - sizeof(*svc->sv_cpt_data)); + sizeof(**svc->sv_cpt_data)); if (!svc->sv_cpt_data) return -ENOMEM; -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 13/14] staging: lustre: llog: limit file size of plain logs
On Feb 24, 2017, at 11:59 AM, Greg Kroah-Hartman wrote: > On Sat, Feb 18, 2017 at 04:47:14PM -0500, James Simmons wrote: >> From: Alex Zhuravlev >> >> on small filesystems plain log can grow dramatically. especially >> given large record sizes produced by DNE and extended chunksize. >> I saw >50% of space consumed by a single llog file which was still >> in use. this leads to test failures (sanityn, etc). >> the patch introduces additional limit on plain llog size, which >> is calculated as /64 (128MB at most) at llog creation >> time. >> >> Signed-off-by: Alex Zhuravlev >> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838 >> Reviewed-on: https://review.whamcloud.com/18028 >> Reviewed-by: Andreas Dilger >> Reviewed-by: wangdi >> Reviewed-by: Mike Pershin >> Reviewed-by: Oleg Drokin >> Signed-off-by: James Simmons >> --- >> drivers/staging/lustre/lustre/obdclass/llog.c | 16 >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c >> b/drivers/staging/lustre/lustre/obdclass/llog.c >> index 83c5b62..320ff6b 100644 >> --- a/drivers/staging/lustre/lustre/obdclass/llog.c >> +++ b/drivers/staging/lustre/lustre/obdclass/llog.c >> @@ -319,10 +319,26 @@ static int llog_process_thread(void *arg) >> * the case and re-read the current chunk >> * otherwise. >> */ >> +int records; >> + >> if (index > loghandle->lgh_last_idx) { >> rc = 0; >> goto out; >> } >> +/* <2 records means no more records >> + * if the last record we processed was >> + * the final one, then the underlying >> + * object might have been destroyed yet. >> + * we better don't access that.. >> + */ >> +mutex_lock(&loghandle->lgh_hdr_mutex); >> +records = loghandle->lgh_hdr->llh_count; >> +mutex_unlock(&loghandle->lgh_hdr_mutex); >> +if (records <= 1) { >> +rc = 0; >> +goto out; >> +} > > > So you now use the lock, in only one place, when reading a single value? > That makes no sense, it's obviously wrong, or not needed. > > Please fix up these two patches… Ah, this is in fact server-side fix, so all the other users were in the parts not really present in the client. James, we don't really need this patch in the client, I guess. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 13/14] staging: lustre: llog: limit file size of plain logs
On Feb 24, 2017, at 11:59 AM, Greg Kroah-Hartman wrote: > On Sat, Feb 18, 2017 at 04:47:14PM -0500, James Simmons wrote: >> From: Alex Zhuravlev >> >> on small filesystems plain log can grow dramatically. especially >> given large record sizes produced by DNE and extended chunksize. >> I saw >50% of space consumed by a single llog file which was still >> in use. this leads to test failures (sanityn, etc). >> the patch introduces additional limit on plain llog size, which >> is calculated as /64 (128MB at most) at llog creation >> time. >> >> Signed-off-by: Alex Zhuravlev >> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6838 >> Reviewed-on: https://review.whamcloud.com/18028 >> Reviewed-by: Andreas Dilger >> Reviewed-by: wangdi >> Reviewed-by: Mike Pershin >> Reviewed-by: Oleg Drokin >> Signed-off-by: James Simmons >> --- >> drivers/staging/lustre/lustre/obdclass/llog.c | 16 >> 1 file changed, 16 insertions(+) >> >> diff --git a/drivers/staging/lustre/lustre/obdclass/llog.c >> b/drivers/staging/lustre/lustre/obdclass/llog.c >> index 83c5b62..320ff6b 100644 >> --- a/drivers/staging/lustre/lustre/obdclass/llog.c >> +++ b/drivers/staging/lustre/lustre/obdclass/llog.c >> @@ -319,10 +319,26 @@ static int llog_process_thread(void *arg) >> * the case and re-read the current chunk >> * otherwise. >> */ >> +int records; >> + >> if (index > loghandle->lgh_last_idx) { >> rc = 0; >> goto out; >> } >> +/* <2 records means no more records >> + * if the last record we processed was >> + * the final one, then the underlying >> + * object might have been destroyed yet. >> + * we better don't access that.. >> + */ >> +mutex_lock(&loghandle->lgh_hdr_mutex); >> +records = loghandle->lgh_hdr->llh_count; >> +mutex_unlock(&loghandle->lgh_hdr_mutex); >> +if (records <= 1) { >> +rc = 0; >> +goto out; >> +} > > > So you now use the lock, in only one place, when reading a single value? > That makes no sense, it's obviously wrong, or not needed. > > Please fix up these two patches… Ah, this is in fact server-side fix, so all the other users were in the parts not really present in the client. James, we don't really need this patch in the client, I guess. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [lustre-devel] [PATCH] staging: lustre: fix sparse warning about different address spaces
On Mar 1, 2017, at 6:57 PM, Mario Bambagini wrote: > fixed the following sparse warning by adding proper cast: > drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74: warning: > incorrect type in argument 2 (different address spaces) > drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74:expected > char const [noderef] * > drivers/staging//lustre/lustre/obdclass/obd_config.c:1055:74:got char > *[assigned] sval > > Signed-off-by: Mario Bambagini The patch is fine, but just be advised this whole function is going away real soon now per Al Viro request (and also because it no longer does what it should). > --- > drivers/staging/lustre/lustre/obdclass/obd_config.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c > b/drivers/staging/lustre/lustre/obdclass/obd_config.c > index 9ca84c7..8fce88f 100644 > --- a/drivers/staging/lustre/lustre/obdclass/obd_config.c > +++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c > @@ -1052,7 +1052,8 @@ int class_process_proc_param(char *prefix, struct > lprocfs_vars *lvars, > > oldfs = get_fs(); > set_fs(KERNEL_DS); > - rc = var->fops->write(&fakefile, sval, > + rc = var->fops->write(&fakefile, > + (const char __user *)sval, > vallen, NULL); > set_fs(oldfs); > } > -- > 2.1.4 > > ___ > lustre-devel mailing list > lustre-de...@lists.lustre.org > http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH/RFC] staging/lustre: Rework class_process_proc_param
Ever since sysfs migration, class_process_proc_param stopped working correctly as all the useful params were no longer present as lvars. Replace all the nasty fake proc writes with hopefully less nasty kobject attribute search and then update the attributes as needed. Signed-off-by: Oleg Drokin Reported-by: Al Viro --- Al has quite rightfully complained in the past that class_process_proc_param is a terrible piece of code and needs to go. This patch is an attempt at improving it somewhat and in process drop all the user/kernel address space games we needed to play to make it work in the past (and which I suspect attracted Al's attention in the first place). Now I wonder if iterating kobject attributes like that would be ok with you Greg, or do you think there is a better way? class_find_write_attr could be turned into something generic since it's certainly convenient to reuse same table of name-write_method pairs, but I did some cursory research and nobody else seems to need anything of the sort in-tree. I know ll_process_config is still awful and I will likely just replace the current hack with kset_find_obj, but I just wanted to make sure this new approach would be ok before spending too much time on it. Thanks! drivers/staging/lustre/lustre/include/obd_class.h | 4 +- drivers/staging/lustre/lustre/llite/llite_lib.c| 10 +-- drivers/staging/lustre/lustre/lov/lov_obd.c| 3 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 3 +- .../staging/lustre/lustre/obdclass/obd_config.c| 78 ++ drivers/staging/lustre/lustre/osc/osc_request.c| 3 +- 6 files changed, 44 insertions(+), 57 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 083a6ff..badafb8 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -114,8 +114,8 @@ typedef int (*llog_cb_t)(const struct lu_env *, struct llog_handle *, struct llog_rec_hdr *, void *); /* obd_config.c */ int class_process_config(struct lustre_cfg *lcfg); -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, -struct lustre_cfg *lcfg, void *data); +int class_process_attr_param(char *prefix, struct kobject *kobj, +struct lustre_cfg *lcfg); struct obd_device *class_incref(struct obd_device *obd, const char *scope, const void *source); void class_decref(struct obd_device *obd, diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 7b80040..192b877 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2259,7 +2259,7 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) int ll_process_config(struct lustre_cfg *lcfg) { char *ptr; - void *sb; + struct super_block *sb; struct lprocfs_static_vars lvars; unsigned long x; int rc = 0; @@ -2273,15 +2273,15 @@ int ll_process_config(struct lustre_cfg *lcfg) rc = kstrtoul(ptr, 16, &x); if (rc != 0) return -EINVAL; - sb = (void *)x; + sb = (struct super_block *)x; /* This better be a real Lustre superblock! */ - LASSERT(s2lsi((struct super_block *)sb)->lsi_lmd->lmd_magic == LMD_MAGIC); + LASSERT(s2lsi(sb)->lsi_lmd->lmd_magic == LMD_MAGIC); /* Note we have not called client_common_fill_super yet, so * proc fns must be able to handle that! */ - rc = class_process_proc_param(PARAM_LLITE, lvars.obd_vars, - lcfg, sb); + rc = class_process_attr_param(PARAM_LLITE, &ll_s2sbi(sb)->ll_kobj, + lcfg); if (rc > 0) rc = 0; return rc; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index b3161fb..c33a327 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -926,8 +926,7 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, lprocfs_lov_init_vars(&lvars); - rc = class_process_proc_param(PARAM_LOV, lvars.obd_vars, - lcfg, obd); + rc = class_process_attr_param(PARAM_LOV, &obd->obd_kobj, lcfg); if (rc > 0) rc = 0; goto out; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 6bc2fb8..00387b8 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -2670,8 +2670,7 @@ static int mdc_process_
Re: [PATCH/RFC] staging/lustre: Rework class_process_proc_param
On Mar 18, 2017, at 6:34 AM, Greg Kroah-Hartman wrote: > On Sat, Mar 18, 2017 at 02:24:08AM -0400, Oleg Drokin wrote: >> Ever since sysfs migration, class_process_proc_param stopped working >> correctly as all the useful params were no longer present as lvars. >> Replace all the nasty fake proc writes with hopefully less nasty >> kobject attribute search and then update the attributes as needed. >> >> Signed-off-by: Oleg Drokin >> Reported-by: Al Viro >> --- >> Al has quite rightfully complained in the past that class_process_proc_param >> is a terrible piece of code and needs to go. >> This patch is an attempt at improving it somewhat and in process drop >> all the user/kernel address space games we needed to play to make it work >> in the past (and which I suspect attracted Al's attention in the first >> place). >> >> Now I wonder if iterating kobject attributes like that would be ok with >> you Greg, or do you think there is a better way? >> class_find_write_attr could be turned into something generic since it's >> certainly convenient to reuse same table of name-write_method pairs, >> but I did some cursory research and nobody else seems to need anything >> of the sort in-tree. >> >> I know ll_process_config is still awful and I will likely just >> replace the current hack with kset_find_obj, but I just wanted to make >> sure this new approach would be ok before spending too much time on it. > > I'm not quite sure what exactly you are even trying to do here. What is > this interface? Who calls it, and how? What does it want to do? This is a configuration client code. Management server has ability to pass down config information in the form of: fsname.subsystem.attribute=value to clients and other servers (subsystem determines if it's something of interest of clients or servers or both). This could be changed in the real time - i.e. you update it on the server and that gets propagated to all the clients/servers, so no need to ssh into every node to manually apply those changes and worry about client restarts (the config is remembered at the management server and would be applied to any new nodes connecting/across server restarts and such). So the way it then works then is once the string fsname.subsystem.attribute=value is delivered to the client, we find all instances of filesystem with fsname and then all subsystems within it (one kobject per subsystem instance) and then update the attributes to the value supplied. The same filesystem might be mounted more than once and then some layers might have multiple instances inside a single filesystems. In the end it would turn something like lustre.osc.max_dirty_mb=128 into writes to /sys/fs/lustre/osc/lustre-OST-osc-8800d75ca000/max_dirty_mb and /sys/fs/lustre/osc/lustre-OST0001-osc-8800d75ca000/max_dirty_mb without actually iterating in sysfs namespace. The alternative we considered is we can probably just do an upcall and have a userspace tool called with the parameter verbatim and try to figure it out, but that seems a lot less ideal, and also we'll get a bunch of complications from containers and such too, I imagine. The function pre-this patch is assuming that all these values are part of a list of procfs values (no longer true after sysfs migration) so just iterates that list and calls the write for matched names (but also needs to supply a userspace buffer so looks much uglier too). Hopefully this makes at least some sense. > You can look up attributes for a kobject easily in the show/store > functions (and some drivers just have a generic one and then you look at > the string to see which attribute you are wanting to reference.) But > you seem to be working backwards here, why do you have to look up a > kobject? But that leads to the need to list attribute names essentially twice: once for the attributes list, once in the show/set function to figure out how to deal with that name. > What is wrong with the "normal" way to interact with kobject attributes > from sysfs? > > What does your "process proc" function do? Where does it get called > from? > > totally confused, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH/RFC] staging/lustre: Rework class_process_proc_param
On Mar 19, 2017, at 12:29 AM, Greg Kroah-Hartman wrote: > On Sat, Mar 18, 2017 at 11:17:55AM -0400, Oleg Drokin wrote: >> >> On Mar 18, 2017, at 6:34 AM, Greg Kroah-Hartman wrote: >> >>> On Sat, Mar 18, 2017 at 02:24:08AM -0400, Oleg Drokin wrote: >>>> Ever since sysfs migration, class_process_proc_param stopped working >>>> correctly as all the useful params were no longer present as lvars. >>>> Replace all the nasty fake proc writes with hopefully less nasty >>>> kobject attribute search and then update the attributes as needed. >>>> >>>> Signed-off-by: Oleg Drokin >>>> Reported-by: Al Viro >>>> --- >>>> Al has quite rightfully complained in the past that >>>> class_process_proc_param >>>> is a terrible piece of code and needs to go. >>>> This patch is an attempt at improving it somewhat and in process drop >>>> all the user/kernel address space games we needed to play to make it work >>>> in the past (and which I suspect attracted Al's attention in the first >>>> place). >>>> >>>> Now I wonder if iterating kobject attributes like that would be ok with >>>> you Greg, or do you think there is a better way? >>>> class_find_write_attr could be turned into something generic since it's >>>> certainly convenient to reuse same table of name-write_method pairs, >>>> but I did some cursory research and nobody else seems to need anything >>>> of the sort in-tree. >>>> >>>> I know ll_process_config is still awful and I will likely just >>>> replace the current hack with kset_find_obj, but I just wanted to make >>>> sure this new approach would be ok before spending too much time on it. >>> >>> I'm not quite sure what exactly you are even trying to do here. What is >>> this interface? Who calls it, and how? What does it want to do? >> >> This is a configuration client code. >> Management server has ability to pass down config information in the form of: >> fsname.subsystem.attribute=value to clients and other servers >> (subsystem determines if it's something of interest of clients or servers or >> both). >> This could be changed in the real time - i.e. you update it on the server and >> that gets propagated to all the clients/servers, so no need to ssh into >> every node to manually apply those changes and worry about client restarts >> (the config is remembered at the management server and would be applied to >> any >> new nodes connecting/across server restarts and such). >> >> So the way it then works then is once the string >> fsname.subsystem.attribute=value is delivered to the client, we find all >> instances of filesystem with fsname and then >> all subsystems within it (one kobject per subsystem instance) and then >> update the >> attributes to the value supplied. >> >> The same filesystem might be mounted more than once and then some layers >> might have >> multiple instances inside a single filesystems. >> >> In the end it would turn something like lustre.osc.max_dirty_mb=128 into >> writes to >> /sys/fs/lustre/osc/lustre-OST-osc-8800d75ca000/max_dirty_mb and >> /sys/fs/lustre/osc/lustre-OST0001-osc-8800d75ca000/max_dirty_mb >> without actually iterating in sysfs namespace. > > Wait, who is doing the "write"? From within the kernel? Or some > userspace app? I'm guessing from within the kernel, you are receiving > the data from some other transport within the filesystem and then need > to apply the settings? Yes, kernel code gets the notification "hey, there's a config change, come get it", then it requests the diff in the config and does the "write' by updating the attributes. >> The alternative we considered is we can probably just do an upcall and have >> a userspace tool called with the parameter verbatim and try to figure it out, >> but that seems a lot less ideal, and also we'll get a bunch of complications >> from >> containers and such too, I imagine. > > Yeah, no, don't do an upcall, that's a mess. > >> The function pre-this patch is assuming that all these values are part of >> a list of procfs values (no longer true after sysfs migration) so just >> iterates >> that list and calls the write for matched names (but also needs to supply a >> userspace >> buffer so looks much uglier too). > > For kobjects, you don't need userspace buffers, so t
Re: [PATCH/RFC] staging/lustre: Rework class_process_proc_param
On Mar 19, 2017, at 12:41 AM, Greg Kroah-Hartman wrote: > On Sat, Mar 18, 2017 at 02:24:08AM -0400, Oleg Drokin wrote: >> Ever since sysfs migration, class_process_proc_param stopped working >> correctly as all the useful params were no longer present as lvars. >> Replace all the nasty fake proc writes with hopefully less nasty >> kobject attribute search and then update the attributes as needed. >> >> Signed-off-by: Oleg Drokin >> Reported-by: Al Viro >> --- >> Al has quite rightfully complained in the past that class_process_proc_param >> is a terrible piece of code and needs to go. >> This patch is an attempt at improving it somewhat and in process drop >> all the user/kernel address space games we needed to play to make it work >> in the past (and which I suspect attracted Al's attention in the first >> place). >> >> Now I wonder if iterating kobject attributes like that would be ok with >> you Greg, or do you think there is a better way? >> class_find_write_attr could be turned into something generic since it's >> certainly convenient to reuse same table of name-write_method pairs, >> but I did some cursory research and nobody else seems to need anything >> of the sort in-tree. >> >> I know ll_process_config is still awful and I will likely just >> replace the current hack with kset_find_obj, but I just wanted to make >> sure this new approach would be ok before spending too much time on it. >> >> Thanks! >> >> drivers/staging/lustre/lustre/include/obd_class.h | 4 +- >> drivers/staging/lustre/lustre/llite/llite_lib.c| 10 +-- >> drivers/staging/lustre/lustre/lov/lov_obd.c| 3 +- >> drivers/staging/lustre/lustre/mdc/mdc_request.c| 3 +- >> .../staging/lustre/lustre/obdclass/obd_config.c| 78 >> ++ >> drivers/staging/lustre/lustre/osc/osc_request.c| 3 +- >> 6 files changed, 44 insertions(+), 57 deletions(-) >> >> diff --git a/drivers/staging/lustre/lustre/include/obd_class.h >> b/drivers/staging/lustre/lustre/include/obd_class.h >> index 083a6ff..badafb8 100644 >> --- a/drivers/staging/lustre/lustre/include/obd_class.h >> +++ b/drivers/staging/lustre/lustre/include/obd_class.h >> @@ -114,8 +114,8 @@ typedef int (*llog_cb_t)(const struct lu_env *, struct >> llog_handle *, >> struct llog_rec_hdr *, void *); >> /* obd_config.c */ >> int class_process_config(struct lustre_cfg *lcfg); >> -int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, >> - struct lustre_cfg *lcfg, void *data); >> +int class_process_attr_param(char *prefix, struct kobject *kobj, >> + struct lustre_cfg *lcfg); > > As you are exporting these functions, they will need to end up with a > lustre_* prefix eventually :) ok. > >> struct obd_device *class_incref(struct obd_device *obd, >> const char *scope, const void *source); >> void class_decref(struct obd_device *obd, >> diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c >> b/drivers/staging/lustre/lustre/llite/llite_lib.c >> index 7b80040..192b877 100644 >> --- a/drivers/staging/lustre/lustre/llite/llite_lib.c >> +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c >> @@ -2259,7 +2259,7 @@ int ll_obd_statfs(struct inode *inode, void __user >> *arg) >> int ll_process_config(struct lustre_cfg *lcfg) >> { >> char *ptr; >> -void *sb; >> +struct super_block *sb; >> struct lprocfs_static_vars lvars; >> unsigned long x; >> int rc = 0; >> @@ -2273,15 +2273,15 @@ int ll_process_config(struct lustre_cfg *lcfg) >> rc = kstrtoul(ptr, 16, &x); >> if (rc != 0) >> return -EINVAL; >> -sb = (void *)x; >> +sb = (struct super_block *)x; >> /* This better be a real Lustre superblock! */ >> -LASSERT(s2lsi((struct super_block *)sb)->lsi_lmd->lmd_magic == >> LMD_MAGIC); >> +LASSERT(s2lsi(sb)->lsi_lmd->lmd_magic == LMD_MAGIC); >> >> /* Note we have not called client_common_fill_super yet, so >> * proc fns must be able to handle that! >> */ >> -rc = class_process_proc_param(PARAM_LLITE, lvars.obd_vars, >> - lcfg, sb); >> +rc = class_process_attr_param(PARAM_LLITE, &ll_s2sbi(sb)->ll_kobj, >> + lcfg); >> if (rc > 0) >> rc = 0; >> return rc; >> diff --git
Re: [PATCH 1/1] Staging: lustre: lnet: libcfs: Fixed checkpatch.pl coding style errors
On Mar 28, 2017, at 6:10 AM, wrote: > From: Vaibhav Kothari > > Shifted open brace { to previous line for 8 functions as indicated by > checkpatch.pl > > Signed-off-by: Vaibhav Kothari > --- > drivers/staging/lustre/lnet/libcfs/hash.c | 43 +++ > 1 file changed, 15 insertions(+), 28 deletions(-) > > diff --git a/drivers/staging/lustre/lnet/libcfs/hash.c > b/drivers/staging/lustre/lnet/libcfs/hash.c > index 5c2ce2e..bb966e2 100644 > --- a/drivers/staging/lustre/lnet/libcfs/hash.c > +++ b/drivers/staging/lustre/lnet/libcfs/hash.c > @@ -1348,8 +1348,7 @@ void cfs_hash_putref(struct cfs_hash *hs) > EXPORT_SYMBOL(cfs_hash_lookup); > > static void > -cfs_hash_for_each_enter(struct cfs_hash *hs) > -{ > +cfs_hash_for_each_enter(struct cfs_hash *hs) { Ugh, no. This is obviously a false positive in checkpatch. > LASSERT(!cfs_hash_is_exiting(hs)); > > if (!cfs_hash_with_rehash(hs)) > @@ -1375,8 +1374,7 @@ void cfs_hash_putref(struct cfs_hash *hs) > } > > static void > -cfs_hash_for_each_exit(struct cfs_hash *hs) > -{ > +cfs_hash_for_each_exit(struct cfs_hash *hs) { > int remained; > int bits; > > @@ -1407,8 +1405,7 @@ void cfs_hash_putref(struct cfs_hash *hs) > */ > static u64 > cfs_hash_for_each_tight(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > - void *data, int remove_safe) > -{ > + void *data, int remove_safe) { > struct hlist_node *hnode; > struct hlist_node *pos; > struct cfs_hash_bd bd; > @@ -1465,8 +1462,7 @@ struct cfs_hash_cond_arg { > > static int > cfs_hash_cond_del_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd, > - struct hlist_node *hnode, void *data) > -{ > + struct hlist_node *hnode, void *data) { > struct cfs_hash_cond_arg *cond = data; > > if (cond->func(cfs_hash_object(hs, hnode), cond->arg)) > @@ -1480,8 +1476,8 @@ struct cfs_hash_cond_arg { > * any object be reference. > */ > void > -cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, void > *data) > -{ > +cfs_hash_cond_del(struct cfs_hash *hs, cfs_hash_cond_opt_cb_t func, > + void *data) { > struct cfs_hash_cond_arg arg = { > .func = func, > .arg= data, > @@ -1493,31 +1489,27 @@ struct cfs_hash_cond_arg { > > void > cfs_hash_for_each(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > - void *data) > -{ > + void *data) { > cfs_hash_for_each_tight(hs, func, data, 0); > } > EXPORT_SYMBOL(cfs_hash_for_each); > > void > cfs_hash_for_each_safe(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > -void *data) > -{ > +void *data) { > cfs_hash_for_each_tight(hs, func, data, 1); > } > EXPORT_SYMBOL(cfs_hash_for_each_safe); > > static int > cfs_hash_peek(struct cfs_hash *hs, struct cfs_hash_bd *bd, > - struct hlist_node *hnode, void *data) > -{ > + struct hlist_node *hnode, void *data) { > *(int *)data = 0; > return 1; /* return 1 to break the loop */ > } > > int > -cfs_hash_is_empty(struct cfs_hash *hs) > -{ > +cfs_hash_is_empty(struct cfs_hash *hs) { > int empty = 1; > > cfs_hash_for_each_tight(hs, cfs_hash_peek, &empty, 0); > @@ -1526,8 +1518,7 @@ struct cfs_hash_cond_arg { > EXPORT_SYMBOL(cfs_hash_is_empty); > > u64 > -cfs_hash_size_get(struct cfs_hash *hs) > -{ > +cfs_hash_size_get(struct cfs_hash *hs) { > return cfs_hash_with_counter(hs) ? > atomic_read(&hs->hs_count) : > cfs_hash_for_each_tight(hs, NULL, NULL, 0); > @@ -1551,8 +1542,7 @@ struct cfs_hash_cond_arg { > */ > static int > cfs_hash_for_each_relax(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > - void *data, int start) > -{ > + void *data, int start) { > struct hlist_node *hnode; > struct hlist_node *tmp; > struct cfs_hash_bd bd; > @@ -1629,8 +1619,7 @@ struct cfs_hash_cond_arg { > > int > cfs_hash_for_each_nolock(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > - void *data, int start) > -{ > + void *data, int start) { > if (cfs_hash_with_no_lock(hs) || > cfs_hash_with_rehash_key(hs) || > !cfs_hash_with_no_itemref(hs)) > @@ -1661,8 +1650,7 @@ struct cfs_hash_cond_arg { > */ > int > cfs_hash_for_each_empty(struct cfs_hash *hs, cfs_hash_for_each_cb_t func, > - void *data) > -{ > + void *data) { > unsigned int i = 0; > > if (cfs_hash_with_no_lock(hs)) > @@ -1718,8 +1706,7 @@ struct cfs_hash_cond_arg { > */ > void > cfs_hash_for_each_key(struct cfs_hash *hs, const void *key, > - cfs_hash_for_each_cb_t func, void *data) > -{ > + cfs_hash_for_each_cb_t func, void *data) { > struct hlist_node *hnode; > struct cfs_hash_bd bds[2]; > unsi
Re: [PATCH] staging: lustre: delete the filesystem from the tree.
> delete mode 100644 drivers/staging/lustre/lustre/lov/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_cl_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_dev.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_ea.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_io.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_lock.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_merge.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_obd.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_object.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_offset.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_pack.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_page.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_pool.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lov_request.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_dev.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_lock.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_object.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lovsub_page.c >> delete mode 100644 drivers/staging/lustre/lustre/lov/lproc_lov.c >> delete mode 100644 drivers/staging/lustre/lustre/mdc/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/mdc/lproc_mdc.c >> delete mode 100644 drivers/staging/lustre/lustre/mdc/mdc_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/mdc/mdc_lib.c >> delete mode 100644 drivers/staging/lustre/lustre/mdc/mdc_locks.c >> delete mode 100644 drivers/staging/lustre/lustre/mdc/mdc_reint.c >> delete mode 100644 drivers/staging/lustre/lustre/mdc/mdc_request.c >> delete mode 100644 drivers/staging/lustre/lustre/mgc/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/mgc/lproc_mgc.c >> delete mode 100644 drivers/staging/lustre/lustre/mgc/mgc_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/mgc/mgc_request.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/cl_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/cl_io.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/cl_lock.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/cl_object.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/cl_page.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/class_obd.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/debug.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/genops.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/kernelcomm.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/linkea.c >> delete mode 100644 >> drivers/staging/lustre/lustre/obdclass/linux/linux-module.c >> delete mode 100644 >> drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_cat.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_obd.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/llog_swab.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lprocfs_counters.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lprocfs_status.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lu_object.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lu_ref.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lustre_handles.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/lustre_peer.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/obd_config.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/obd_mount.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/obdo.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/statfs_pack.c >> delete mode 100644 drivers/staging/lustre/lustre/obdclass/uuid.c >> delete mode 100644 drivers/staging/lustre/lustre/obdecho/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/obdecho/echo_client.c >> delete mode 100644 drivers/staging/lustre/lustre/obdecho/echo_internal.h >> delete mode 100644 drivers/staging/lustre/lustre/osc/Makefile >> delete mode 100644 drivers/staging/lustre/lustre/osc/lp
Re: [PATCH] staging/lustre: Always try kmalloc first for OBD_ALLOC_LARGE
Hello! On May 3, 2015, at 2:31 PM, Greg KH wrote: >> -/* Allocations above this size are considered too big and could not be done >> - * atomically. >> - * >> - * Be very careful when changing this value, especially when decreasing it, >> - * since vmalloc in Linux doesn't perform well on multi-cores system, >> calling >> - * vmalloc in critical path would hurt performance badly. See LU-66. >> - */ >> -#define OBD_ALLOC_BIG (4 * PAGE_CACHE_SIZE) >> - >> #define OBD_ALLOC_LARGE(ptr, size) \ >> do { \ >> -if (size > OBD_ALLOC_BIG)\ >> -OBD_VMALLOC(ptr, size);\ >> -else \ >> -OBD_ALLOC(ptr, size);\ >> +ptr = libcfs_kvzalloc(size, GFP_NOFS);\ >> } while (0) > > Just fix up all callers of these functions, if there are any anymore. This is what Julia is doing. I am providing the stub for her wonderful scripts to unwrap per her request. >> + */ >> +/* >> + * Copyright (c) 2015, Oleg Drokin > > I think your employer would like a different line here... Only on stuff that I do at work when I am getting paid. Stuff that I do on my own uncompensated, I own all the rights to, I hope. Bye, Oleg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH 0/3] Moving lustre procfs stuff to sysfs & questions.
On May 3, 2015, at 2:15 PM, Greg Kroah-Hartman wrote: >> Also I found that cgroup does calls into kernfs directly, gaining >> ability to register seq_file files and otherwise do all sorts of >> stuff that would be cool to do from lustre too ;) > If you want to make lustrefs, be my guest, you can do whatever you want > in that, using kernfs, but that's not ok for sysfs, sorry. If only __kernfs_create_file was exported… ;) Otherwise you cannot really do that from modules. Bye, Oleg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] staging/lustre: Move /proc/fs/lustre root level files to sysfs
On May 3, 2015, at 2:13 PM, Greg Kroah-Hartman wrote: >> >> -#if defined (CONFIG_PROC_FS) >> -static int obd_proc_version_seq_show(struct seq_file *m, void *v) >> +static ssize_t version_show(struct kobject *kobj, char *buf) >> { >> -seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n", >> - LUSTRE_VERSION_STRING, "patchless_client", BUILD_VERSION); >> -return 0; >> +return snprintf(buf, PAGE_SIZE, "lustre: %s\nkernel: %s\nbuild: %s\n", > > If you are using sysfs, you never need snprintf() as you had better only > be sending something smaller than a page, or your code is wrong. Well, I am copying straight from ext4 here (and in other places), that I thought was a good model. Is there a better model? I guess I can convert to sprintfs in most of places, though. > As it is here, again, please sysfs is one-value-per-file. > > Yes, in some places we mess up and don't do that, but as long as I'm > reviewing stuff, you better stick to that. > > And you don't need the kernel version here, or the build version, as all > of that is obvious from other api calls (i.e. uname). That would be true if only people did not apply patches to their kernels. I guess we don't care all that much about kernel version here as it could be obtained from uname, but lustre version is kind of important for the case that people patch it up (and they do), so can I leave just that? > So this file isn't needed at all. > >> +LUSTRE_VERSION_STRING, "patchless_client", >> +BUILD_VERSION); >> } >> -LPROC_SEQ_FOPS_RO(obd_proc_version); >> >> -int obd_proc_pinger_seq_show(struct seq_file *m, void *v) >> +static ssize_t pinger_show(struct kobject *kobj, char *buf) >> { >> -seq_printf(m, "%s\n", "on"); >> -return 0; >> +return snprintf(buf, PAGE_SIZE, "%s\n", "on"); >> } > > If it can never be a different value, why have this file at all? > >> -LPROC_SEQ_FOPS_RO(obd_proc_pinger); >> >> -static int obd_proc_health_seq_show(struct seq_file *m, void *v) >> +static ssize_t health_show(struct kobject *kobj, char *buf) >> { >> bool healthy = true; >> int i; >> +size_t offset = 0; >> >> if (libcfs_catastrophe) >> -seq_printf(m, "LBUG\n"); >> +offset = snprintf(buf, PAGE_SIZE, "LBUG\n"); >> >> read_lock(&obd_dev_lock); >> for (i = 0; i < class_devno_max(); i++) { > > This is not a single value per file. > > Are you sure you shouldn't just be using debugfs for some of these? You > can do whatever you want in debugfs. As long as you can still run if > debugfs isn't enabled. I am definitely going to use debugfs in some cases. This particular one I guess we'll need to split into per-obd health status and the overall "system health" that could be easily queried. >> +#if defined(CONFIG_PROC_FS) >> /* Root for /proc/fs/lustre */ >> struct proc_dir_entry *proc_lustre_root = NULL; >> EXPORT_SYMBOL(proc_lustre_root); >> >> struct lprocfs_vars lprocfs_base[] = { >> -{ "version", &obd_proc_version_fops }, >> -{ "pinger", &obd_proc_pinger_fops }, >> -{ "health_check", &obd_proc_health_fops }, >> -{ "jobid_var", &obd_proc_jobid_var_fops }, >> -{ .name = "jobid_name", >> - .fops = &obd_proc_jobid_name_fops}, >> { NULL } >> }; >> >> +LUSTRE_RO_ATTR(version); >> +LUSTRE_RO_ATTR(pinger); >> +LUSTRE_RO_ATTR(health); >> +LUSTRE_RW_ATTR(jobid_var); >> +LUSTRE_RW_ATTR(jobid_name); > > Are these static? If not, why not? Yes, they are static. >> +static struct attribute *lustre_attrs[] = { >> +LUSTRE_ATTR_LIST(version), >> +LUSTRE_ATTR_LIST(pinger), >> +LUSTRE_ATTR_LIST(health), >> +LUSTRE_ATTR_LIST(jobid_name), >> +LUSTRE_ATTR_LIST(jobid_var), > > Do you really need this type of macro? Just spell the structures out. Again, I am going by the fine example of ext4 here. But I am happy to spell it out if you think it's better that way. >> +NULL, >> +}; >> + >> static void *obd_device_list_seq_start(struct seq_file *p, loff_t *pos) >> { >> if (*pos >= class_devno_max()) >> @@ -419,15 +422,36 @@ struct file_operations obd_device_list_fops = { >> .release = seq_release, >> }; >> >> +struct kobject lustre_kobj; >> +EXPORT_SYMBOL(lustre_kobj); > > EXPORT_SYMBOL_GPL? > > >> + >> +static DECLARE_COMPLETION(lustre_kobj_unregister); >> +static void lustre_sysfs_release(struct kobject *kobj) >> +{ >> +complete(&lustre_kobj_unregister); > > Not good, you should just clean up and go, this means something is > really wrong, and you should NEVER have a static kobject. Which you do. > Which is wrong. This is how we tell the cleanup code that we are all done, though? Otherwise if I do kobject_put there and move on (to module unload), how all the other potential users of my kobject would be protected from the code disappearign from under them? I can dynamically allocate lustre_kobj, but that does not really help this particular scenario. >> +} >> + >>
Re: [PATCH 00/25] Start of removal of lustre procfs support
Hm, Actually please don't merge this one yet. I have a better one in the works that I'll hopefully send in the next couple of days. Thanks. On May 16, 2015, at 3:30 AM, gr...@linuxhacker.ru wrote: > From: Oleg Drokin > > This is beginning of work in the area. It takes a bit longer than > anticipated, so I don't want for you (Greg) to have an impression > we disppeared again on this issue. > > Patches move all sensible parameters from /proc/fs/lustre and > /proc/fs/lustre/llite to /sys/fs/lustre. Teh remaining files would be > moved to debugfs separately. > > Additionally a bunch of /proc/sys/lnet/ controls is removed either > as no longer needed or because they are accessible as libcfs module > parameters so probably no point in having several ways of accessing > them. > > Conversion of other subsystems and more sysctl rearranging will > follow somewhat soon, onc ewe actually get them to work properly. > > Dmitry Eremin (2): > staging/lustre/libcfs: Remove redundant enums and sysctl moduleparams > staging/lustre/libcfs: Remove unneeded lnet watchdog_ratelimit sysctl > > Oleg Drokin (23): > staging/lustre: Generic helpers for sysfs > staging/lustre: Move /proc/fs/lustre root level files to sysfs > staging/lustre/llite: Preparation to move /proc/fs/lustre/llite to >sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/blocksize to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/kbytes* to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/files* to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/client_type to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/fstype to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/uuid to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/max_read_ahead_mb to >sysfs > staging/lustre/llite: move llite/max_read_ahead_per_file_mb to sysfs > taging/lustre/llite: move llite/max_read_ahead_whole_mb to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/checksum_pages to >sysfs > staging/lustre/llite: remove unused ll_max_rw_chunk > staging/lustre/llite: move /proc/fs/lustre/llite/stats_track* to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/statahead_{max,agl} >to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/lazystatfs to sysfs > staging/lustre/llite: move /proc/fs/lustre/llite/*_easize to sysfs > staging/lustre/llite: remove llite/*_cookiesize proc files > staging/lustre/llite: move /proc/fs/lustre/llite/xattr_cache to sysfs > staging/lustre/libcfs: Remove redundant sysctl moduleparams > staging/lustre/libcfs: get rid of /proc/sys/lnet/console_backoff > staging/lustre: remove alloc_fail_rate sysctl > > .../lustre/include/linux/libcfs/libcfs_debug.h | 1 - > .../lustre/include/linux/libcfs/libcfs_private.h | 28 +- > .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 12 - > .../staging/lustre/lnet/klnds/socklnd/socklnd.c| 5 - > .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 3 +- > drivers/staging/lustre/lnet/lnet/router_proc.c | 11 - > .../staging/lustre/lustre/include/lprocfs_status.h | 21 + > .../staging/lustre/lustre/include/obd_support.h| 12 +- > drivers/staging/lustre/lustre/libcfs/debug.c | 37 +- > drivers/staging/lustre/lustre/libcfs/module.c | 110 > .../staging/lustre/lustre/llite/llite_internal.h | 9 +- > drivers/staging/lustre/lustre/llite/llite_lib.c| 8 +- > drivers/staging/lustre/lustre/llite/lproc_llite.c | 572 ++--- > drivers/staging/lustre/lustre/llite/super25.c | 11 +- > drivers/staging/lustre/lustre/obdclass/class_obd.c | 6 +- > .../lustre/lustre/obdclass/linux/linux-module.c| 106 ++-- > .../lustre/lustre/obdclass/linux/linux-sysctl.c| 38 -- > .../lustre/lustre/obdclass/lprocfs_status.c| 24 + > drivers/staging/lustre/sysfs-fs-lustre | 192 +++ > 19 files changed, 620 insertions(+), 586 deletions(-) > create mode 100644 drivers/staging/lustre/sysfs-fs-lustre > > -- > 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 54/58] staging/lustre/obd: remove unused proc_lustre_root
On May 30, 2015, at 10:22 PM, Greg Kroah-Hartman wrote: > On Thu, May 21, 2015 at 03:32:28PM -0400, gr...@linuxhacker.ru wrote: >> From: Dmitry Eremin >> >> Signed-off-by: Dmitry Eremin >> --- >> drivers/staging/lustre/lustre/include/lprocfs_status.h | 3 --- >> .../lustre/lustre/obdclass/linux/linux-module.c| 18 >> -- >> 2 files changed, 21 deletions(-) > > Always test-build your patches. This breaks the build as there is > obviously still an in-tree user. > > I've stopped applying the series at this point. Looks really good, nice > job. Can you fix this one up and resend the remaining ones in the > series? Will do. Thanks! ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [staging:staging-testing 524/578] drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:721:343: warning: (near initialization for 'lustre_attr_recalc_period.store')
On May 31, 2015, at 2:32 AM, Greg Kroah-Hartman wrote: > On Sun, May 31, 2015 at 11:59:50AM +0800, kbuild test robot wrote: >> tree: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git >> staging-testing >> head: 895875a3d85596e3e2e46aeb382bf14f1419de82 >> commit: 24b8c88a7122df35ce6a413cd76e9581411eab8f [524/578] >> staging/lustre/ldlm: move procfs ldlm pool stats to sysfs >> config: i386-allyesconfig (attached as .config) >> reproduce: >> git checkout 24b8c88a7122df35ce6a413cd76e9581411eab8f >> # save the attached .config to linux build tree >> make ARCH=i386 >> >> All warnings: >> >> >> drivers/staging/lustre/lustre/ptlrpc/../../lustre/ldlm/ldlm_pool.c:721:343: >> warning: initialization from incompatible pointer type >>LUSTRE_RW_ATTR(recalc_period); >> > > > > > Very odd warning, Oleg, can you send a patch to fix this up? Whoops, done. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] Lustre fixes
This is a set of patches that eliminates rest of crashes and most leaks hit during standard lustre regression testing for me. This serie + O_LOV_DELAY_CREATE patch from Andreas (that was submitted separately and needs separate approval: http://www.spinics.net/lists/linux-fsdevel/msg72386.html ) makes most of the sanity testing to also pass. Andrew Perepechko (1): lustre/xattr: separate ACL and XATTR caches Bobi Jam (1): lustre/lov: avoid subobj's coh_parent race John L. Hammond (1): lustre: don't leak llog handle in llog_cat_process_cb() Swapnil Pimpale (1): lustre: Unsafe error handling around ll_splice_alias yang sheng (1): lustre: instantiate negative dentry .../lustre/lustre/include/lustre/lustre_idl.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 - .../staging/lustre/lustre/llite/llite_internal.h | 7 -- drivers/staging/lustre/lustre/llite/namei.c| 15 ++- drivers/staging/lustre/lustre/llite/statahead.c| 9 +- drivers/staging/lustre/lustre/llite/xattr.c| 29 +++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 117 - drivers/staging/lustre/lustre/lov/lov_object.c | 10 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 4 + drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 9 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 30 +- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 3 +- 15 files changed, 100 insertions(+), 146 deletions(-) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] lustre: don't leak llog handle in llog_cat_process_cb()
From: "John L. Hammond" An early return from llog_cat_process_cb() was leaking the llog handle. Fix this by not doing that. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/7847 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4054 Reviewed-by: Andreas Dilger Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Mike Pershin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/obdclass/llog_cat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c index c0f3af7..1d999310 100644 --- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c +++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c @@ -551,9 +551,8 @@ int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, if (rec->lrh_index < d->lpd_startcat) /* Skip processing of the logs until startcat */ - return 0; - - if (d->lpd_startidx > 0) { + rc = 0; + else if (d->lpd_startidx > 0) { struct llog_process_cat_data cd; cd.lpcd_first_idx = d->lpd_startidx; @@ -566,6 +565,7 @@ int llog_cat_process_cb(const struct lu_env *env, struct llog_handle *cat_llh, rc = llog_process_or_fork(env, llh, d->lpd_cb, d->lpd_data, NULL, false); } + llog_handle_put(llh); return rc; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] lustre/lov: avoid subobj's coh_parent race
From: Bobi Jam * during a file lov object initialization, we need protect the access and change of its subobj->coh_parent, since it could be another layout change race there, which makes an unreferenced lovsub obj in the site object hash table. * dump lovsub objects in the site if the lovsub device reference > 0 during its finalization phase. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/6105 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1480 Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/lov_object.c | 10 +++--- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 4 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c b/drivers/staging/lustre/lustre/lov/lov_object.c index df8b5b5..fe0b70a 100644 --- a/drivers/staging/lustre/lustre/lov/lov_object.c +++ b/drivers/staging/lustre/lustre/lov/lov_object.c @@ -122,8 +122,8 @@ static struct cl_object *lov_sub_find(const struct lu_env *env, } static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, - struct cl_object *stripe, - struct lov_layout_raid0 *r0, int idx) + struct cl_object *stripe, struct lov_layout_raid0 *r0, + int idx) { struct cl_object_header *hdr; struct cl_object_header *subhdr; @@ -144,7 +144,6 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, hdr= cl_object_header(lov2cl(lov)); subhdr = cl_object_header(stripe); - parent = subhdr->coh_parent; oinfo = lov->lo_lsm->lsm_oinfo[idx]; CDEBUG(D_INODE, DFID"@%p[%d] -> "DFID"@%p: ostid: "DOSTID @@ -153,8 +152,12 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, PFID(&hdr->coh_lu.loh_fid), hdr, POSTID(&oinfo->loi_oi), oinfo->loi_ost_idx, oinfo->loi_ost_gen); + /* reuse ->coh_attr_guard to protect coh_parent change */ + spin_lock(&subhdr->coh_attr_guard); + parent = subhdr->coh_parent; if (parent == NULL) { subhdr->coh_parent = hdr; + spin_unlock(&subhdr->coh_attr_guard); subhdr->coh_nesting = hdr->coh_nesting + 1; lu_object_ref_add(&stripe->co_lu, "lov-parent", lov); r0->lo_sub[idx] = cl2lovsub(stripe); @@ -166,6 +169,7 @@ static int lov_init_sub(const struct lu_env *env, struct lov_object *lov, struct lov_object *old_lov; unsigned int mask = D_INODE; + spin_unlock(&subhdr->coh_attr_guard); old_obj = lu_object_locate(&parent->coh_lu, &lov_device_type); LASSERT(old_obj != NULL); old_lov = cl2lov(lu2cl(old_obj)); diff --git a/drivers/staging/lustre/lustre/lov/lovsub_dev.c b/drivers/staging/lustre/lustre/lov/lovsub_dev.c index 998ea1c..926c35a 100644 --- a/drivers/staging/lustre/lustre/lov/lovsub_dev.c +++ b/drivers/staging/lustre/lustre/lov/lovsub_dev.c @@ -131,6 +131,10 @@ static struct lu_device *lovsub_device_free(const struct lu_env *env, struct lovsub_device *lsd = lu2lovsub_dev(d); struct lu_device *next = cl2lu_dev(lsd->acid_next); + if (atomic_read(&d->ld_ref) && d->ld_site) { + LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_ERROR, NULL); + lu_site_print(env, d->ld_site, &msgdata, lu_cdebug_printer); + } cl_device_fini(lu2cl_dev(d)); OBD_FREE_PTR(lsd); return next; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] lustre/xattr: separate ACL and XATTR caches
From: Andrew Perepechko This patch separates ACL and XATTR caches, so that when updating an ACL only LOOKUP lock is needed and when updating another XATTR only XATTR lock is needed. This patch also reverts XATTR cache support for setxattr because client performing REINT under even PR lock will deadlock if an active server operation (like unlink) attempts to cancel all locks, and setxattr has to wait for it (MDC max-in-flight is 1). This patch disables the r/o cache if the data is unreasonably large (larger than maximum single EA size). Signed-off-by: Andrew Perepechko Signed-off-by: Nathaniel Clark Reviewed-on: http://review.whamcloud.com/7208 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3669 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 1 - drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 - .../staging/lustre/lustre/llite/llite_internal.h | 7 -- drivers/staging/lustre/lustre/llite/xattr.c| 29 +++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 117 - drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 9 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c| 30 +- drivers/staging/lustre/lustre/ptlrpc/layout.c | 3 +- 10 files changed, 68 insertions(+), 134 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 05c77c0..4183a35 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1747,7 +1747,6 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) OBD_MD_FLGID | OBD_MD_FLFLAGS | OBD_MD_FLNLINK | \ OBD_MD_FLGENER | OBD_MD_FLRDEV | OBD_MD_FLGROUP) -#define OBD_MD_FLXATTRLOCKED OBD_MD_FLGETATTRLOCK #define OBD_MD_FLXATTRALL (OBD_MD_FLXATTR | OBD_MD_FLXATTRLS) /* don't forget obdo_fid which is way down at the bottom so it can diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 692623b..0548aca 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -145,8 +145,6 @@ char *ldlm_it2str(int it) return "getxattr"; case IT_LAYOUT: return "layout"; - case IT_SETXATTR: - return "setxattr"; default: CERROR("Unknown intent %d\n", it); return "UNKNOWN"; diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 28669ea..bc17c29 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -296,13 +296,6 @@ int ll_xattr_cache_get(struct inode *inode, size_t size, __u64 valid); -int ll_xattr_cache_update(struct inode *inode, - const char *name, - const char *newval, - size_t size, - __u64 valid, - int flags); - /* * Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS. diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index af83580..b1ed4d9 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -183,17 +183,11 @@ int ll_setxattr_common(struct inode *inode, const char *name, valid |= rce_ops2valid(rce->rce_ops); } #endif - if (sbi->ll_xattr_cache_enabled && - (rce == NULL || rce->rce_ops == RMT_LSETFACL)) { - rc = ll_xattr_cache_update(inode, name, pv, size, valid, flags); - } else { oc = ll_mdscapa_get(inode); rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc, valid, name, pv, size, 0, flags, ll_i2suppgid(inode), &req); capa_put(oc); - } - #ifdef CONFIG_FS_POSIX_ACL if (new_value != NULL) lustre_posix_acl_xattr_free(new_value, size); @@ -292,6 +286,7 @@ int ll_getxattr_common(struct inode *inode, const char *name, void *xdata; struct obd_capa *oc; struct rmtacl_ctl_entry *rce = NULL; + struct ll_inode_info *lli = ll_i2info(inode); CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino, inode->i_genera
[PATCH 3/5] lustre: instantiate negative dentry
From: yang sheng In the atomic_open callback. We should instantiate negative dentry. Else will got sanity:183 failed. Signed-off-by: yang sheng Reviewed-on: http://review.whamcloud.com/8110 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3228 Reviewed-by: Peng Tao Reviewed-by: Lai Siyao Reviewed-by: James Simmons Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/namei.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 8938d37..93c3744 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -468,6 +468,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request, if (IS_ERR(alias)) return PTR_ERR(alias); *de = alias; + } else if (!it_disposition(it, DISP_LOOKUP_NEG) && + !it_disposition(it, DISP_OPEN_CREATE)) { + /* With DISP_OPEN_CREATE dentry will + instantiated in ll_create_it. */ + LASSERT((*de)->d_inode == NULL); + d_instantiate(*de, inode); } if (!it_disposition(it, DISP_LOOKUP_NEG)) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] lustre: Unsafe error handling around ll_splice_alias
From: Swapnil Pimpale Callers of ll_splice_alias() should not assign the returned pointer to the dentry since it can be an err pointer. Fixed the above bug using a temporary dentry pointer. This temporary pointer is assigned to dentry only if ll_splice_alias has not returned an err pointer. Signed-off-by: Swapnil Pimpale Reviewed-on: http://review.whamcloud.com/7460 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3807 Reviewed-by: Fan Yong Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/namei.c | 9 ++--- drivers/staging/lustre/lustre/llite/statahead.c | 9 ++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 1d03a6f..8938d37 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -462,9 +462,12 @@ int ll_lookup_it_finish(struct ptlrpc_request *request, * Atoimc_open may passin hashed dentries for open. */ if (d_unhashed(*de)) { - *de = ll_splice_alias(inode, *de); - if (IS_ERR(*de)) - return PTR_ERR(*de); + struct dentry *alias; + + alias = ll_splice_alias(inode, *de); + if (IS_ERR(alias)) + return PTR_ERR(alias); + *de = alias; } if (!it_disposition(it, DISP_LOOKUP_NEG)) { diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 183b415..ad61ad4 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -1585,12 +1585,15 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, ll_inode2fid(inode), &bits); if (rc == 1) { if ((*dentryp)->d_inode == NULL) { - *dentryp = ll_splice_alias(inode, + struct dentry *alias; + + alias = ll_splice_alias(inode, *dentryp); - if (IS_ERR(*dentryp)) { + if (IS_ERR(alias)) { ll_sai_unplug(sai, entry); - return PTR_ERR(*dentryp); + return PTR_ERR(alias); } + *dentryp = alias; } else if ((*dentryp)->d_inode != inode) { /* revalidate, but inode is recreated */ CDEBUG(D_READA, -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/17] lustre/mdc: use ibits_known mask for lock match
From: Alexey Lyashkov Before revalidating a lock on the client, mask the lock bits against the lock bits supported by the server (ibits_known), so newer clients will find valid locks given by older server versions. Signed-off-by: Patrick Farrell Signed-off-by: Alexey Lyashkov Reviewed-on: http://review.whamcloud.com/8636 Xyratex-bug-id: MRP-1583 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4405 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_export.h | 8 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 8 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 2feb38b..82a230b 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -380,6 +380,14 @@ static inline bool imp_connect_lvb_type(struct obd_import *imp) return false; } +static inline __u64 exp_connect_ibits(struct obd_export *exp) +{ + struct obd_connect_data *ocd; + + ocd = &exp->exp_connect_data; + return ocd->ocd_ibits_known; +} + extern struct obd_export *class_conn2export(struct lustre_handle *conn); extern struct obd_device *class_conn2obd(struct lustre_handle *conn); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index d9017a5..6ef9e28 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -160,6 +160,8 @@ ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags, ldlm_mode_t rc; fid_build_reg_res_name(fid, &res_id); + /* LU-4405: Clear bits not supported by server */ + policy->l_inodebits.bits &= exp_connect_ibits(exp); rc = ldlm_lock_match(class_exp2obd(exp)->obd_namespace, flags, &res_id, type, policy, mode, lockh, 0); return rc; @@ -1087,10 +1089,10 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, break; } - mode = ldlm_lock_match(exp->exp_obd->obd_namespace, - LDLM_FL_BLOCK_GRANTED, &res_id, + mode = mdc_lock_match(exp, LDLM_FL_BLOCK_GRANTED, fid, LDLM_IBITS, &policy, - LCK_CR|LCK_CW|LCK_PR|LCK_PW, &lockh, 0); + LCK_CR | LCK_CW | LCK_PR | LCK_PW, + &lockh); } if (mode) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/17] lustre/ldlm: set l_lvb_type coherent when layout is returned
From: Bruno Faccini In case layout has been packed into server reply when not requested, lock l_lvb_type must be set accordingly. Signed-off-by: Bruno Faccini Reviewed-on: http://review.whamcloud.com/8270 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4194 Reviewed-by: Jinshan Xiong Reviewed-by: Johann Lombardi Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 1 + drivers/staging/lustre/lustre/mdc/mdc_locks.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c index 3ed020e..d87048d 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c @@ -228,6 +228,7 @@ static void ldlm_handle_cp_callback(struct ptlrpc_request *req, lock_res_and_lock(lock); LASSERT(lock->l_lvb_data == NULL); + lock->l_lvb_type = LVB_T_LAYOUT; lock->l_lvb_data = lvb_data; lock->l_lvb_len = lvb_len; unlock_res_and_lock(lock); diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 81adc2b..b0d0e2a 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -753,6 +753,7 @@ static int mdc_finish_enqueue(struct obd_export *exp, /* install lvb_data */ lock_res_and_lock(lock); if (lock->l_lvb_data == NULL) { + lock->l_lvb_type = LVB_T_LAYOUT; lock->l_lvb_data = lmm; lock->l_lvb_len = lvb_len; lmm = NULL; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/17] lustre/llite: Do not send parent dir fid in getattr by fid
Sending getattr by fid in this case is pointless, as the parent might havelong changed and we have no control over it, but it's irrelevant anyway, since we already have the child fid. Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/7910 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3240 Reviewed-by: Dmitry Eremin Reviewed-by: wangdi Reviewed-by: Andreas Dilger --- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index fd0dd20e..7fbc18e 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash, struct ptlrpc_request *request; struct md_op_data *op_data; - op_data = ll_prep_md_op_data(NULL, dir, NULL, NULL, 0, 0, + op_data = ll_prep_md_op_data(NULL, dir, dir, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) return (void *)op_data; diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c9ee574..36c54aa 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2891,7 +2891,7 @@ int __ll_inode_revalidate_it(struct dentry *dentry, struct lookup_intent *it, oit.it_op = IT_LOOKUP; /* Call getattr by fid, so do not provide name at all. */ - op_data = ll_prep_md_op_data(NULL, dentry->d_parent->d_inode, + op_data = ll_prep_md_op_data(NULL, dentry->d_inode, dentry->d_inode, NULL, 0, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/17] lustre/mdc: Check for all attributes validity in revalidate
GETATTR needs to return attributes protected by different bits, so we need to ensure all we have locks with all of those bits, not just UPDATE bit Signed-off-by: Alexey Lyashkov Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/6460 Xyratex-bug-id: MRP-1052 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3240 Reviewed-by: Dmitry Eremin Reviewed-by: wangdi Reviewed-by: Andreas Dilger --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 16 +++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 288a41e..1336d47 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -1061,7 +1061,20 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, fid_build_reg_res_name(fid, &res_id); switch (it->it_op) { case IT_GETATTR: - policy.l_inodebits.bits = MDS_INODELOCK_UPDATE; + /* File attributes are held under multiple bits: +* nlink is under lookup lock, size and times are +* under UPDATE lock and recently we've also got +* a separate permissions lock for owner/group/acl that +* were protected by lookup lock before. +* Getattr must provide all of that information, +* so we need to ensure we have all of those locks. +* Unfortunately, if the bits are split across multiple +* locks, there's no easy way to match all of them here, +* so an extra RPC would be performed to fetch all +* of those bits at once for now. */ + policy.l_inodebits.bits = MDS_INODELOCK_UPDATE | + MDS_INODELOCK_LOOKUP | + MDS_INODELOCK_PERM; break; case IT_LAYOUT: policy.l_inodebits.bits = MDS_INODELOCK_LAYOUT; @@ -1070,6 +1083,7 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, policy.l_inodebits.bits = MDS_INODELOCK_LOOKUP; break; } + mode = ldlm_lock_match(exp->exp_obd->obd_namespace, LDLM_FL_BLOCK_GRANTED, &res_id, LDLM_IBITS, &policy, -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/17] lustre/clio: honor O_NOATIME
From: "John L. Hammond" Add a ci_noatime bit to struct cl_io. In ll_io_init() set this bit if O_NOATIME is set in f_flags. Ensure that this bit is propagated down to lower layers. In osc_io_read_start() don't update atime if this bit is set. Add sanity test 39n to check that passing O_NOATIME to open() is honored. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/7442 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3832 Reviewed-by: Jinshan Xiong Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/cl_object.h | 6 - drivers/staging/lustre/lustre/llite/file.c| 29 +++ drivers/staging/lustre/lustre/lov/lov_io.c| 1 + drivers/staging/lustre/lustre/osc/osc_io.c| 14 --- 4 files changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h index 4d692dc..76e1b68 100644 --- a/drivers/staging/lustre/lustre/include/cl_object.h +++ b/drivers/staging/lustre/lustre/include/cl_object.h @@ -2392,7 +2392,11 @@ struct cl_io { /** * file is released, restore has to to be triggered by vvp layer */ -ci_restore_needed:1; +ci_restore_needed:1, + /** +* O_NOATIME +*/ +ci_noatime:1; /** * Number of pages owned by this IO. For invariant checking. */ diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 36c54aa..362f5ec 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1035,6 +1035,33 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm, return rc; } +static bool file_is_noatime(const struct file *file) +{ + const struct vfsmount *mnt = file->f_path.mnt; + const struct inode *inode = file->f_path.dentry->d_inode; + + /* Adapted from file_accessed() and touch_atime().*/ + if (file->f_flags & O_NOATIME) + return true; + + if (inode->i_flags & S_NOATIME) + return true; + + if (IS_NOATIME(inode)) + return true; + + if (mnt->mnt_flags & (MNT_NOATIME | MNT_READONLY)) + return true; + + if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode)) + return true; + + if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) + return true; + + return false; +} + void ll_io_init(struct cl_io *io, const struct file *file, int write) { struct inode *inode = file->f_dentry->d_inode; @@ -1054,6 +1081,8 @@ void ll_io_init(struct cl_io *io, const struct file *file, int write) } else if (file->f_flags & O_APPEND) { io->ci_lockreq = CILR_MANDATORY; } + + io->ci_noatime = file_is_noatime(file); } static ssize_t diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c index 5a6ab70..65133ea 100644 --- a/drivers/staging/lustre/lustre/lov/lov_io.c +++ b/drivers/staging/lustre/lustre/lov/lov_io.c @@ -194,6 +194,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio, sub_io->ci_lockreq = io->ci_lockreq; sub_io->ci_type= io->ci_type; sub_io->ci_no_srvlock = io->ci_no_srvlock; + sub_io->ci_noatime = io->ci_noatime; lov_sub_enter(sub); result = cl_io_sub_init(sub->sub_env, sub_io, diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 777ae24..5f3c545 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -512,19 +512,15 @@ static int osc_io_read_start(const struct lu_env *env, struct osc_io*oio = cl2osc_io(env, slice); struct cl_object *obj = slice->cis_obj; struct cl_attr *attr = &osc_env_info(env)->oti_attr; - int result = 0; + int rc = 0; - if (oio->oi_lockless == 0) { + if (oio->oi_lockless == 0 && !slice->cis_io->ci_noatime) { cl_object_attr_lock(obj); - result = cl_object_attr_get(env, obj, attr); - if (result == 0) { - attr->cat_atime = LTIME_S(CURRENT_TIME); - result = cl_object_attr_set(env, obj, attr, - CAT_ATIME); - } + attr->cat_atime = LTIME_S(CURRENT_TIME); + rc = cl_object_attr_set
[PATCH 04/17] lustre/mdc: comments on LOOKUP and PERM lock
From: wang di Add more comments for MDS_INODELOCK_PERM and MDS_INODELOCK_LOOKUP Signed-off-by: wang di Reviewed-on: http://review.whamcloud.com/7937 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3240 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 24 -- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 3 +++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 4183a35..4c70c06 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2116,12 +2116,24 @@ extern void lustre_swab_generic_32s (__u32 *val); #define DISP_OPEN_LEASE 0x0400 /* INODE LOCK PARTS */ -#define MDS_INODELOCK_LOOKUP 0x01 /* dentry, mode, owner, group */ -#define MDS_INODELOCK_UPDATE 0x02 /* size, links, timestamps */ -#define MDS_INODELOCK_OPEN 0x04 /* For opened files */ -#define MDS_INODELOCK_LAYOUT 0x08 /* for layout */ -#define MDS_INODELOCK_PERM 0x10 /* for permission */ -#define MDS_INODELOCK_XATTR 0x20 /* extended attributes */ +#define MDS_INODELOCK_LOOKUP 0x01 /* For namespace, dentry etc, and also +* was used to protect permission (mode, +* owner, group etc) before 2.4. */ +#define MDS_INODELOCK_UPDATE 0x02 /* size, links, timestamps */ +#define MDS_INODELOCK_OPEN 0x04 /* For opened files */ +#define MDS_INODELOCK_LAYOUT 0x08 /* for layout */ + +/* The PERM bit is added int 2.4, and it is used to protect permission(mode, + * owner, group, acl etc), so to separate the permission from LOOKUP lock. + * Because for remote directories(in DNE), these locks will be granted by + * different MDTs(different ldlm namespace). + * + * For local directory, MDT will always grant UPDATE_LOCK|PERM_LOCK together. + * For Remote directory, the master MDT, where the remote directory is, will + * grant UPDATE_LOCK|PERM_LOCK, and the remote MDT, where the name entry is, + * will grant LOOKUP_LOCK. */ +#define MDS_INODELOCK_PERM 0x10 +#define MDS_INODELOCK_XATTR 0x20 /* extended attributes */ #define MDS_INODELOCK_MAXSHIFT 5 /* This FULL lock is useful to take on unlink sort of operations */ diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 1336d47..d9017a5 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -1072,6 +1072,9 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, * locks, there's no easy way to match all of them here, * so an extra RPC would be performed to fetch all * of those bits at once for now. */ + /* For new MDTs(> 2.4), UPDATE|PERM should be enough, +* but for old MDTs (< 2.4), permission is covered +* by LOOKUP lock, so it needs to match all bits here.*/ policy.l_inodebits.bits = MDS_INODELOCK_UPDATE | MDS_INODELOCK_LOOKUP | MDS_INODELOCK_PERM; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/17] lustre/mdc: fix bad ERR_PTR usage in mdc_locks.c
From: "John L. Hammond" In mdc_intent_open_pack() return an ERR_PTR() rather than NULL when ldlm_prep_enqueue_req() fails. In mdc_intent_getattr_async() check the return value of mdc_intent_getattr_pack() using IS_ERR(). Clean up the includes in mdc_locks.c. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/7886 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4078 Reviewed-by: Andreas Dilger Reviewed-by: Nathaniel Clark Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 6ef9e28..6110943 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -37,15 +37,15 @@ #define DEBUG_SUBSYSTEM S_MDC # include -# include -# include -#include +#include +#include #include #include -/* fid_res_name_eq() */ -#include -#include +#include /* fid_res_name_eq() */ +#include +#include +#include #include "mdc_internal.h" struct mdc_getattr_args { @@ -336,9 +336,9 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp, max(lmmsize, obddev->u.cli.cl_default_mds_easize)); rc = ldlm_prep_enqueue_req(exp, req, &cancels, count); - if (rc) { + if (rc < 0) { ptlrpc_request_free(req); - return NULL; + return ERR_PTR(rc); } spin_lock(&req->rq_lock); @@ -1281,8 +1281,8 @@ int mdc_intent_getattr_async(struct obd_export *exp, fid_build_reg_res_name(&op_data->op_fid1, &res_id); req = mdc_intent_getattr_pack(exp, it, op_data); - if (!req) - return -ENOMEM; + if (IS_ERR(req)) + return PTR_ERR(req); rc = mdc_enter_request(&obddev->u.cli); if (rc != 0) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/17] staging/lustre/llite: fix open lock matching in ll_md_blocking_ast()
From: "John L. Hammond" In ll_md_blocking_ast() match open locks before all others, ensuring that MDS_INODELOCK_OPEN is not cleared from bits by another open lock with a different mode. Change the int flags parameter of ll_md_real_close() to fmode_t fmode. Clean up verious style issues in both functions. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/8718 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4429 Reviewed-by: Niu Yawei Reviewed-by: Jinshan Xiong Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/file.c | 19 +++--- .../staging/lustre/lustre/llite/llite_internal.h | 2 +- drivers/staging/lustre/lustre/llite/namei.c| 78 -- 3 files changed, 54 insertions(+), 45 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 4c28f39..c9ee574 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -205,7 +205,7 @@ out: return rc; } -int ll_md_real_close(struct inode *inode, int flags) +int ll_md_real_close(struct inode *inode, fmode_t fmode) { struct ll_inode_info *lli = ll_i2info(inode); struct obd_client_handle **och_p; @@ -213,30 +213,33 @@ int ll_md_real_close(struct inode *inode, int flags) __u64 *och_usecount; int rc = 0; - if (flags & FMODE_WRITE) { + if (fmode & FMODE_WRITE) { och_p = &lli->lli_mds_write_och; och_usecount = &lli->lli_open_fd_write_count; - } else if (flags & FMODE_EXEC) { + } else if (fmode & FMODE_EXEC) { och_p = &lli->lli_mds_exec_och; och_usecount = &lli->lli_open_fd_exec_count; } else { - LASSERT(flags & FMODE_READ); + LASSERT(fmode & FMODE_READ); och_p = &lli->lli_mds_read_och; och_usecount = &lli->lli_open_fd_read_count; } mutex_lock(&lli->lli_och_mutex); - if (*och_usecount) { /* There are still users of this handle, so - skip freeing it. */ + if (*och_usecount > 0) { + /* There are still users of this handle, so skip +* freeing it. */ mutex_unlock(&lli->lli_och_mutex); return 0; } + och=*och_p; *och_p = NULL; mutex_unlock(&lli->lli_och_mutex); - if (och) { /* There might be a race and somebody have freed this och - already */ + if (och != NULL) { + /* There might be a race and this handle may already + be closed. */ rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp, inode, och, NULL); } diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index e27efd1..47c5142 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -775,7 +775,7 @@ int ll_local_open(struct file *file, int ll_release_openhandle(struct dentry *, struct lookup_intent *); int ll_md_close(struct obd_export *md_exp, struct inode *inode, struct file *file); -int ll_md_real_close(struct inode *inode, int flags); +int ll_md_real_close(struct inode *inode, fmode_t fmode); void ll_ioepoch_close(struct inode *inode, struct md_op_data *op_data, struct obd_client_handle **och, unsigned long flags); void ll_done_writing_attr(struct inode *inode, struct md_op_data *op_data); diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c index 93c3744..86ff708 100644 --- a/drivers/staging/lustre/lustre/llite/namei.c +++ b/drivers/staging/lustre/lustre/llite/namei.c @@ -195,101 +195,107 @@ static void ll_invalidate_negative_children(struct inode *dir) int ll_md_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, void *data, int flag) { - int rc; struct lustre_handle lockh; + int rc; switch (flag) { case LDLM_CB_BLOCKING: ldlm_lock2handle(lock, &lockh); rc = ldlm_cli_cancel(&lockh, LCF_ASYNC); if (rc < 0) { - CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc); + CDEBUG(D_INODE, "ldlm_cli_cancel: rc = %d\n", rc); return rc; } break; case LDLM_CB_CANCELING: { struct inode *inode = ll_inode_from_resource_lock(lock); - struct ll_inode_info *lli; __u64 bits = lock->l_policy_data.l_inod
[PATCH 00/17] Lustre stability patches
This series of patches fixes most of the issues I hit during Lustre regression test suite. All observed crashes are gone too. Please consider for inclusion. Alexey Lyashkov (1): lustre/mdc: use ibits_known mask for lock match Ann Koehler (1): lustre/osc: Don't flush active extents. Bruno Faccini (1): lustre/ldlm: set l_lvb_type coherent when layout is returned Hongchao Zhang (1): lustre/recovery: free open/close request promptly John L. Hammond (3): staging/lustre/llite: fix open lock matching in ll_md_blocking_ast() lustre/clio: honor O_NOATIME lustre/mdc: fix bad ERR_PTR usage in mdc_locks.c Lai Siyao (1): lustre/llite: simplify dentry revalidate Liang Zhen (2): lustre/ptlrpc: rq_commit_cb is called for twice lustre/ptlrpc: re-enqueue ptlrpcd worker Niu Yawei (1): lustre/quota: improper assert in osc_quota_chkdq() Oleg Drokin (3): lustre/mdc: Check for all attributes validity in revalidate lustre/llite: Do not send parent dir fid in getattr by fid lustre/libcfs: warn if all HTs in a core are gone Peng Tao (1): lustre/ptlrpc: skip rpcs that fail ptl_send_rpc Sebastien Buisson (1): lustre/ptlrpc: fix 'data race condition' issues wang di (1): lustre/mdc: comments on LOOKUP and PERM lock drivers/staging/lustre/lustre/include/cl_object.h | 6 +- .../lustre/lustre/include/lustre/lustre_idl.h | 32 ++- .../staging/lustre/lustre/include/lustre_export.h | 17 ++ .../staging/lustre/lustre/include/lustre_import.h | 11 + drivers/staging/lustre/lustre/include/lustre_net.h | 2 + drivers/staging/lustre/lustre/include/obd.h| 5 +- drivers/staging/lustre/lustre/include/obd_class.h | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c| 1 + .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 19 +- drivers/staging/lustre/lustre/llite/dcache.c | 290 ++--- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 60 +++-- .../staging/lustre/lustre/llite/llite_internal.h | 6 +- drivers/staging/lustre/lustre/llite/llite_lib.c| 3 +- drivers/staging/lustre/lustre/llite/namei.c| 78 +++--- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 1 - drivers/staging/lustre/lustre/lmv/lmv_obd.c| 5 +- drivers/staging/lustre/lustre/lov/lov_io.c | 1 + drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 102 drivers/staging/lustre/lustre/mdc/mdc_reint.c | 1 + drivers/staging/lustre/lustre/mdc/mdc_request.c| 27 +- drivers/staging/lustre/lustre/obdclass/genops.c| 2 + .../lustre/lustre/obdclass/lprocfs_status.c| 1 + drivers/staging/lustre/lustre/osc/osc_cache.c | 6 + drivers/staging/lustre/lustre/osc/osc_io.c | 14 +- drivers/staging/lustre/lustre/osc/osc_quota.c | 7 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 155 --- drivers/staging/lustre/lustre/ptlrpc/import.c | 33 ++- drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 4 + drivers/staging/lustre/lustre/ptlrpc/recover.c | 57 +++- 31 files changed, 480 insertions(+), 474 deletions(-) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/17] lustre/recovery: free open/close request promptly
From: Hongchao Zhang - For the non-create open or committed open, the open request should be freed along with the close request as soon as the close done, despite that the transno of open/close is greater than the last committed transno known by client or not. - Move the committed open request into another dedicated list, that will avoid scanning a huge replay list on receiving each reply (when there are many open files). Signed-off-by: Niu Yawei Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/6665 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2613 Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 6 +- .../staging/lustre/lustre/include/lustre_export.h | 9 +++ .../staging/lustre/lustre/include/lustre_import.h | 11 +++ drivers/staging/lustre/lustre/include/lustre_net.h | 2 + drivers/staging/lustre/lustre/include/obd.h| 5 +- drivers/staging/lustre/lustre/include/obd_class.h | 4 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/llite_lib.c| 3 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c| 4 +- drivers/staging/lustre/lustre/mdc/mdc_internal.h | 2 +- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 1 + drivers/staging/lustre/lustre/mdc/mdc_request.c| 27 +++- drivers/staging/lustre/lustre/obdclass/genops.c| 2 + .../lustre/lustre/obdclass/lprocfs_status.c| 1 + drivers/staging/lustre/lustre/ptlrpc/client.c | 78 +- drivers/staging/lustre/lustre/ptlrpc/import.c | 33 ++--- drivers/staging/lustre/lustre/ptlrpc/recover.c | 57 +--- 18 files changed, 198 insertions(+), 51 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 4c70c06..a55eebf 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1305,6 +1305,7 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); #define OBD_CONNECT_SHORTIO 0x2ULL/* short io */ #define OBD_CONNECT_PINGLESS 0x4ULL/* pings not required */ #define OBD_CONNECT_FLOCK_DEAD 0x8ULL/* flock deadlock detection */ +#define OBD_CONNECT_DISP_STRIPE 0x10ULL/*create stripe disposition*/ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same @@ -1344,7 +1345,9 @@ extern void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb); OBD_CONNECT_LIGHTWEIGHT | OBD_CONNECT_UMASK | \ OBD_CONNECT_LVB_TYPE | OBD_CONNECT_LAYOUTLOCK |\ OBD_CONNECT_PINGLESS | OBD_CONNECT_MAX_EASIZE |\ - OBD_CONNECT_FLOCK_DEAD) + OBD_CONNECT_FLOCK_DEAD | \ + OBD_CONNECT_DISP_STRIPE) + #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ OBD_CONNECT_TRUNCLOCK | OBD_CONNECT_INDEX | \ @@ -2114,6 +2117,7 @@ extern void lustre_swab_generic_32s (__u32 *val); #define DISP_ENQ_CREATE_REF 0x0100 #define DISP_OPEN_LOCK 0x0200 #define DISP_OPEN_LEASE 0x0400 +#define DISP_OPEN_STRIPE 0x0800 /* INODE LOCK PARTS */ #define MDS_INODELOCK_LOOKUP 0x01 /* For namespace, dentry etc, and also diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h index 82a230b..6f7f48c 100644 --- a/drivers/staging/lustre/lustre/include/lustre_export.h +++ b/drivers/staging/lustre/lustre/include/lustre_export.h @@ -388,6 +388,15 @@ static inline __u64 exp_connect_ibits(struct obd_export *exp) return ocd->ocd_ibits_known; } +static inline bool imp_connect_disp_stripe(struct obd_import *imp) +{ + struct obd_connect_data *ocd; + + LASSERT(imp != NULL); + ocd = &imp->imp_connect_data; + return ocd->ocd_connect_flags & OBD_CONNECT_DISP_STRIPE; +} + extern struct obd_export *class_conn2export(struct lustre_handle *conn); extern struct obd_device *class_conn2obd(struct lustre_handle *conn); diff --git a/drivers/staging/lustre/lustre/include/lustre_import.h b/drivers/staging/lustre/lustre/include/lustre_import.h index 67259eb..e9833ae 100644 --- a/drivers/staging/lustre/lustre/include/lustre_import.h +++ b/drivers/staging/lustre/lustre/include/lustre_import.h @@ -180,6 +180,17 @@ struct obd_import { struct list_headimp_delayed_list; /** @} */ + /** +* List of requests that are retained for committed
[PATCH 14/17] lustre/ptlrpc: re-enqueue ptlrpcd worker
From: Liang Zhen osc_extent_wait can be stuck in scenario like this: 1) thread-1 held an active extent 2) thread-2 called flush cache, and marked this extent as "urgent" and "sync_wait" 3) thread-3 wants to write to the same extent, osc_extent_find will get "conflict" because this extent is "sync_wait", so it starts to wait... 4) cl_writeback_work has been scheduled by thread-4 to write some other extents, it has sent RPCs but not returned yet. 5) thread-1 finished his work, and called osc_extent_release()-> osc_io_unplug_async()->ptlrpcd_queue_work(), but found cl_writeback_work is still running, so it's ignored (-EBUSY) 6) thread-3 is stuck because nobody will wake him up. This patch allows ptlrpcd_work to be rescheduled, so it will not miss request anymore Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/8922 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4509 Reviewed-by: Jinshan Xiong Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/client.c | 64 +-- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 7b97c64..4c9e006 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -48,6 +48,7 @@ #include "ptlrpc_internal.h" static int ptlrpc_send_new_req(struct ptlrpc_request *req); +static int ptlrpcd_check_work(struct ptlrpc_request *req); /** * Initialize passed in client structure \a cl. @@ -1784,6 +1785,10 @@ interpret: ptlrpc_req_interpret(env, req, req->rq_status); + if (ptlrpcd_check_work(req)) { + atomic_dec(&set->set_remaining); + continue; + } ptlrpc_rqphase_move(req, RQ_PHASE_COMPLETE); CDEBUG(req->rq_reqmsg != NULL ? D_RPCTRACE : 0, @@ -2957,22 +2962,50 @@ EXPORT_SYMBOL(ptlrpc_sample_next_xid); *have delay before it really runs by ptlrpcd thread. */ struct ptlrpc_work_async_args { - __u64 magic; int (*cb)(const struct lu_env *, void *); void *cbdata; }; -#define PTLRPC_WORK_MAGIC 0x6655436b676f4f44ULL /* magic code */ +static void ptlrpcd_add_work_req(struct ptlrpc_request *req) +{ + /* re-initialize the req */ + req->rq_timeout = obd_timeout; + req->rq_sent= cfs_time_current_sec(); + req->rq_deadline= req->rq_sent + req->rq_timeout; + req->rq_reply_deadline = req->rq_deadline; + req->rq_phase = RQ_PHASE_INTERPRET; + req->rq_next_phase = RQ_PHASE_COMPLETE; + req->rq_xid = ptlrpc_next_xid(); + req->rq_import_generation = req->rq_import->imp_generation; + + ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1); +} static int work_interpreter(const struct lu_env *env, struct ptlrpc_request *req, void *data, int rc) { struct ptlrpc_work_async_args *arg = data; - LASSERT(arg->magic == PTLRPC_WORK_MAGIC); + LASSERT(ptlrpcd_check_work(req)); LASSERT(arg->cb != NULL); - return arg->cb(env, arg->cbdata); + rc = arg->cb(env, arg->cbdata); + + list_del_init(&req->rq_set_chain); + req->rq_set = NULL; + + if (atomic_dec_return(&req->rq_refcount) > 1) { + atomic_set(&req->rq_refcount, 2); + ptlrpcd_add_work_req(req); + } + return rc; +} + +static int worker_format; + +static int ptlrpcd_check_work(struct ptlrpc_request *req) +{ + return req->rq_pill.rc_fmt == (void *)&worker_format; } /** @@ -3005,6 +3038,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, req->rq_receiving_reply = 0; req->rq_must_unlink = 0; req->rq_no_delay = req->rq_no_resend = 1; + req->rq_pill.rc_fmt = (void *)&worker_format; spin_lock_init(&req->rq_lock); INIT_LIST_HEAD(&req->rq_list); @@ -3018,7 +3052,6 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, CLASSERT(sizeof(*args) <= sizeof(req->rq_async_args)); args = ptlrpc_req_async_args(req); - args->magic = PTLRPC_WORK_MAGIC; args->cb = cb; args->cbdata = cbdata; @@ -3048,25 +3081,8 @@ int ptlrpcd_queue_work(void *handler) * req as opaque data. - Jinshan */ LASSERT(atomic_read(&req->rq_refcount) > 0); - if (atomic_read(&req->rq_refcount) > 1) - return -EBUSY; - - if (atomic_inc_return(&req->rq_refcount) > 2) { /* race */ - atomic_dec(&req->rq_refcount
[PATCH 12/17] lustre/ptlrpc: skip rpcs that fail ptl_send_rpc
From: Peng Tao ptl_send_rpc is not dealing with -ENOMEM in some situations. When the ptl_send_rpc fails we need set error and skip further processing or trigger and LBUG Signed-off-by: Keith Mannthey Signed-off-by: Peng Tao Reviewed-on: http://review.whamcloud.com/7411 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3698 Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index b6d831a..98041e8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1692,6 +1692,7 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) spin_lock(&req->rq_lock); req->rq_net_err = 1; spin_unlock(&req->rq_lock); + continue; } /* need to reset the timeout */ force_timer_recalc = 1; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/17] lustre/ptlrpc: rq_commit_cb is called for twice
From: Liang Zhen If a ptlrpc_request is already on imp::imp_replay_list, when it's replayed and replied, after_reply() will call req::rq_commit_cb for the request, then call it again in ptlrpc_free_committed. Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/8815 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3618 Reviewed-by: Alex Zhuravlev Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index a32b722..b6d831a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1313,7 +1313,11 @@ static int after_reply(struct ptlrpc_request *req) /** version recovery */ ptlrpc_save_versions(req); ptlrpc_retain_replayable_request(req, imp); - } else if (req->rq_commit_cb != NULL) { + } else if (req->rq_commit_cb != NULL && + list_empty(&req->rq_replay_list)) { + /* NB: don't call rq_commit_cb if it's already on +* rq_replay_list, ptlrpc_free_committed() will call +* it later, see LU-3618 for details */ spin_unlock(&imp->imp_lock); req->rq_commit_cb(req); spin_lock(&imp->imp_lock); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/17] lustre/osc: Don't flush active extents.
From: Ann Koehler The extent is active so we need to abort and let the caller re-dirty the page. If we continued on here, and we were the one making the extent active, we could deadlock waiting for the page writeback to clear but it won't because the extent is active and won't be written out. Signed-off-by: Ann Koehler Reviewed-on: http://review.whamcloud.com/8278 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4253 Reviewed-by: Jinshan Xiong Reviewed-by: Alex Zhuravlev Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/osc/osc_cache.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c b/drivers/staging/lustre/lustre/osc/osc_cache.c index b92a02e..af25c19 100644 --- a/drivers/staging/lustre/lustre/osc/osc_cache.c +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c @@ -2394,6 +2394,12 @@ int osc_flush_async_page(const struct lu_env *env, struct cl_io *io, * really sending the RPC. */ case OES_TRUNC: /* race with truncate, page will be redirtied */ + case OES_ACTIVE: + /* The extent is active so we need to abort and let the caller +* re-dirty the page. If we continued on here, and we were the +* one making the extent active, we could deadlock waiting for +* the page writeback to clear but it won't because the extent +* is active and won't be written out. */ GOTO(out, rc = -EAGAIN); default: break; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/17] lustre/libcfs: warn if all HTs in a core are gone
libcfs cpu partition can't support CPU hotplug, but it is safe when plug-in new CPU or enabling/disabling hyper-threading. It has potential risk only if plug-out CPU because it may break CPU affinity of Lustre threads. Current libcfs will print warning for all CPU notification, this patch changed this behavior and only output warning when we lost all HTs in a CPU core which may have broken affinity of Lustre threads. Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/8770 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4454 Reviewed-by: Bobi Jam Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- .../staging/lustre/lustre/libcfs/linux/linux-cpu.c| 19 --- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 58bb256..77b1ef6 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -952,6 +952,7 @@ static int cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) { unsigned int cpu = (unsigned long)hcpu; + bool warn; switch (action) { case CPU_DEAD: @@ -962,9 +963,21 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) cpt_data.cpt_version++; spin_unlock(&cpt_data.cpt_lock); default: - CWARN("Lustre: can't support CPU hotplug well now, " - "performance and stability could be impacted" - "[CPU %u notify: %lx]\n", cpu, action); + if (action != CPU_DEAD && action != CPU_DEAD_FROZEN) { + CDEBUG(D_INFO, "CPU changed [cpu %u action %lx]\n", + cpu, action); + break; + } + + down(&cpt_data.cpt_mutex); + /* if all HTs in a core are offline, it may break affinity */ + cfs_cpu_ht_siblings(cpu, cpt_data.cpt_cpumask); + warn = any_online_cpu(*cpt_data.cpt_cpumask) >= nr_cpu_ids; + up(&cpt_data.cpt_mutex); + CDEBUG(warn ? D_WARNING : D_INFO, + "Lustre: can't support CPU plug-out well now, " + "performance and stability could be impacted " + "[CPU %u action: %lx]\n", cpu, action); } return NOTIFY_OK; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/17] lustre/llite: simplify dentry revalidate
From: Lai Siyao Lustre client dentry validation is protected by LDLM lock, so any time a dentry is found, it's valid and no need to revalidate from MDS, and even it does, there is race that it may be invalidated after revalidation is finished. Signed-off-by: Lai Siyao Reviewed-on: http://review.whamcloud.com/7475 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544 Reviewed-by: Peng Tao Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/llite/dcache.c | 290 ++--- drivers/staging/lustre/lustre/llite/file.c | 8 +- .../staging/lustre/lustre/llite/llite_internal.h | 4 +- drivers/staging/lustre/lustre/lmv/lmv_intent.c | 1 - drivers/staging/lustre/lustre/lmv/lmv_obd.c| 1 - drivers/staging/lustre/lustre/mdc/mdc_locks.c | 52 ++-- 7 files changed, 45 insertions(+), 313 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index a55eebf..5f5b0ba 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -2112,7 +2112,7 @@ extern void lustre_swab_generic_32s (__u32 *val); #define DISP_LOOKUP_POS 0x0008 #define DISP_OPEN_CREATE 0x0010 #define DISP_OPEN_OPEN 0x0020 -#define DISP_ENQ_COMPLETE0x0040 +#define DISP_ENQ_COMPLETE0x0040/* obsolete and unused */ #define DISP_ENQ_OPEN_REF0x0080 #define DISP_ENQ_CREATE_REF 0x0100 #define DISP_OPEN_LOCK 0x0200 diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 3907c87..f971a54 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -241,9 +241,6 @@ void ll_intent_release(struct lookup_intent *it) ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */ if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ ptlrpc_req_finished(it->d.lustre.it_data); - if (it_disposition(it, DISP_ENQ_COMPLETE)) /* saved req from revalidate - * to lookup */ - ptlrpc_req_finished(it->d.lustre.it_data); it->d.lustre.it_disposition = 0; it->d.lustre.it_data = NULL; @@ -328,262 +325,32 @@ void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft) } -int ll_revalidate_it(struct dentry *de, int lookup_flags, -struct lookup_intent *it) +static int ll_revalidate_dentry(struct dentry *dentry, + unsigned int lookup_flags) { - struct md_op_data *op_data; - struct ptlrpc_request *req = NULL; - struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; - struct obd_export *exp; - struct inode *parent = de->d_parent->d_inode; - int rc; - - CDEBUG(D_VFSTRACE, "VFS Op:name=%s,intent=%s\n", de->d_name.name, - LL_IT2STR(it)); - - LASSERT(de != de->d_sb->s_root); - - if (de->d_inode == NULL) { - __u64 ibits; - - /* We can only use negative dentries if this is stat or lookup, - for opens and stuff we do need to query server. */ - /* If there is IT_CREAT in intent op set, then we must throw - away this negative dentry and actually do the request to - kernel to create whatever needs to be created (if possible)*/ - if (it && (it->it_op & IT_CREAT)) - return 0; + struct inode *dir = dentry->d_parent->d_inode; - if (d_lustre_invalid(de)) - return 0; - - ibits = MDS_INODELOCK_UPDATE; - rc = ll_have_md_lock(parent, &ibits, LCK_MINMODE); - GOTO(out_sa, rc); - } - - /* Never execute intents for mount points. -* Attributes will be fixed up in ll_inode_revalidate_it */ - if (d_mountpoint(de)) - GOTO(out_sa, rc = 1); - - exp = ll_i2mdexp(de->d_inode); - - OBD_FAIL_TIMEOUT(OBD_FAIL_MDC_REVALIDATE_PAUSE, 5); - ll_frob_intent(&it, &lookup_it); - LASSERT(it); + /* +* if open&create is set, talk to MDS to make sure file is created if +* necessary, because we can't do this in ->open() later since that's +* called on an inode. return 0 here to let lookup to handle this. +*/ + if ((lookup_flags & (LOOKUP_OPEN | LOOKUP_CREATE)) == + (LOOKUP_OPEN | LOOKUP_CREATE)) + return 0; - if (it->it_op ==
[PATCH 16/17] lustre/quota: improper assert in osc_quota_chkdq()
From: Niu Yawei In osc_quota_chkdq(), we should never try to access oqi found from hash, since it could have been freed by osc_quota_setdq(). Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/8460 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4336 Reviewed-by: Johann Lombardi Reviewed-by: Fan Yong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/osc/osc_quota.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c b/drivers/staging/lustre/lustre/osc/osc_quota.c index 6045a78..f395ae4 100644 --- a/drivers/staging/lustre/lustre/osc/osc_quota.c +++ b/drivers/staging/lustre/lustre/osc/osc_quota.c @@ -51,11 +51,8 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[]) oqi = cfs_hash_lookup(cli->cl_quota_hash[type], &qid[type]); if (oqi) { - obd_uid id = oqi->oqi_id; - - LASSERTF(id == qid[type], -"The ids don't match %u != %u\n", -id, qid[type]); + /* do not try to access oqi here, it could have been +* freed by osc_quota_setdq() */ /* the slot is busy, the user is about to run out of * quota space on this OST */ -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/17] lustre/ptlrpc: fix 'data race condition' issues
From: Sebastien Buisson Fix 'data race condition' defects found by Coverity version 6.5.0: Data race condition (MISSING_LOCK) Accessing variable without holding lock. Elsewhere, this variable is accessed with lock held. Signed-off-by: Sebastien Buisson Reviewed-on: http://review.whamcloud.com/6575 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744 Reviewed-by: Andreas Dilger Signed-off-by: Oeg Drokin --- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 ++ drivers/staging/lustre/lustre/ptlrpc/niobuf.c | 4 2 files changed, 10 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 98041e8..7b97c64 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -1190,7 +1190,9 @@ static int after_reply(struct ptlrpc_request *req) * will roundup it */ req->rq_replen = req->rq_nob_received; req->rq_nob_received = 0; + spin_lock(&req->rq_lock); req->rq_resend = 1; + spin_unlock(&req->rq_lock); return 0; } @@ -1412,7 +1414,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) req->rq_status = rc; return 1; } else { + spin_lock(&req->rq_lock); req->rq_wait_ctx = 1; + spin_unlock(&req->rq_lock); return 0; } } @@ -1427,7 +1431,9 @@ static int ptlrpc_send_new_req(struct ptlrpc_request *req) rc = ptl_send_rpc(req, 0); if (rc) { DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc); + spin_lock(&req->rq_lock); req->rq_net_err = 1; + spin_unlock(&req->rq_lock); return rc; } return 0; diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c index 1e94597..a47a8d8 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c +++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c @@ -511,7 +511,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) CDEBUG(D_HA, "muting rpc for failed imp obd %s\n", request->rq_import->imp_obd->obd_name); /* this prevents us from waiting in ptlrpc_queue_wait */ + spin_lock(&request->rq_lock); request->rq_err = 1; + spin_unlock(&request->rq_lock); request->rq_status = -ENODEV; return -ENODEV; } @@ -553,7 +555,9 @@ int ptl_send_rpc(struct ptlrpc_request *request, int noreply) if (rc) { /* this prevents us from looping in * ptlrpc_queue_wait */ + spin_lock(&request->rq_lock); request->rq_err = 1; + spin_unlock(&request->rq_lock); request->rq_status = rc; GOTO(cleanup_bulk, rc); } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] lustre: add myself to list of people to CC on lustre patches
Hello! On Mar 26, 2014, at 4:44 AM, Geert Uytterhoeven wrote: >>> and http://kisskb.ellerman.id.au/kisskb/buildresult/10508264/ >>> will turn green again? >> I certainly hope so. > Ping? > We got a new "fix" for this in due to https://lkml.org/lkml/2014/2/13/479 Well, I certainly hoped for some better response with https://lkml.org/lkml/2014/2/4/18 ;) I guess I will clean it up and try it again. Bye, Oleg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/47] staging/lustre/ptlrpc: Remove log message about export timer update
From: Cheng Shao Function ptlrpc_update_export_timer generates lots of D_HA level log messages whenever the export timer gets updated. Those log messages are found little use for issue investigations, and it will take space in the Lustre log buffer. We are removing it now. Xyratex-bug-id: MRP-733 Signed-off-by: Cheng Shao Reviewed-on: http://review.whamcloud.com/9147 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4590 Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/service.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 192adec..5873c03 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c @@ -1042,9 +1042,6 @@ static void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay) return; exp->exp_last_request_time = new_time; - CDEBUG(D_HA, "updating export %s at "CFS_TIME_T" exp %p\n", - exp->exp_client_uuid.uuid, - exp->exp_last_request_time, exp); /* exports may get disconnected from the chain even though the export has references, so we must keep the spin lock while -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/47] staging/lustre/lnet: Dropped messages are not accounted correctly
From: Matt Ezell LNET messages that are dropped are not accounted for correctly in /proc/sys/lnet/stats. What I assume to be a simple typo is causing drop_length to be double-counted and drop_count to never be incremented. Signed-off-by: Matt Ezell Reviewed-on: http://review.whamcloud.com/9096 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4577 Reviewed-by: James Nunez Reviewed-by: James Simmons Reviewed-by: Isaac Huang Reviewed-by: Liang Zhen Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/api-ni.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 45c2319..3f3c341 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -338,7 +338,7 @@ lnet_counters_get(lnet_counters_t *counters) counters->send_count += ctr->send_count; counters->recv_count += ctr->recv_count; counters->route_count += ctr->route_count; - counters->drop_length += ctr->drop_length; + counters->drop_count += ctr->drop_count; counters->send_length += ctr->send_length; counters->recv_length += ctr->recv_length; counters->route_length += ctr->route_length; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/47] staging/lustre/ptlrpc: Fix assertion failure of null_alloc_rs()
From: Patrick Farrell lustre_get_emerg_rs() set the size of the reply buffer to zero by mistake, which will cause LBUG in null_alloc_rs() when memory pressure is high. This patch fix this problem and adds a size check to avoid the problem of insufficient buffer size. Signed-off-by: Li Xi Signed-off-by: Patrick Farrell Reviewed-on: http://review.whamcloud.com/8200 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3680 Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 1 + drivers/staging/lustre/lustre/ptlrpc/sec.c | 12 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c index 45c0b84..cddeeb6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c +++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c @@ -300,6 +300,7 @@ lustre_get_emerg_rs(struct ptlrpc_service_part *svcpt) spin_unlock(&svcpt->scp_rep_lock); memset(rs, 0, svcpt->scp_service->srv_max_reply_size); + rs->rs_size = svcpt->scp_service->srv_max_reply_size; rs->rs_svcpt = svcpt; rs->rs_prealloc = 1; out: diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index b0a1c5a..5e75392 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -2086,8 +2086,18 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int msglen) rc = policy->sp_sops->alloc_rs(req, msglen); if (unlikely(rc == -ENOMEM)) { + struct ptlrpc_service_part *svcpt = req->rq_rqbd->rqbd_svcpt; + if (svcpt->scp_service->srv_max_reply_size < + msglen + sizeof(struct ptlrpc_reply_state)) { + /* Just return failure if the size is too big */ + CERROR("size of message is too big (%zd), %d allowed", + msglen + sizeof(struct ptlrpc_reply_state), + svcpt->scp_service->srv_max_reply_size); + return -ENOMEM; + } + /* failed alloc, try emergency pool */ - rs = lustre_get_emerg_rs(req->rq_rqbd->rqbd_svcpt); + rs = lustre_get_emerg_rs(svcpt); if (rs == NULL) return -ENOMEM; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/47] staging/lustre/ptlrpc: don't try to recover no_recov connection
From: Andreas Dilger If a connection has been stopped with ptlrpc_pinger_del_import() and marked obd_no_recov, don't reconnect in ptlrpc_disconnect_import() if the import is already disconnected. Otherwise, without the pinger it will just wait there indefinitely for the reconnection that will never happen. Put the obd_no_recov check inside ptlrpc_import_in_recovery() so that any threads waiting on the connection to recover would also be broken out of their sleep if obd_no_recov is set. Signed-off-by: Andreas Dilger Reviewed-on: http://review.whamcloud.com/8996 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4413 Reviewed-by: Nathaniel Clark Reviewed-by: wangdi Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/import.c | 29 +- drivers/staging/lustre/lustre/ptlrpc/recover.c | 5 - 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index a04a1cc..b231452 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -1404,26 +1404,33 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) { struct ptlrpc_request *req; int rq_opc, rc = 0; - int nowait = imp->imp_obd->obd_force; - if (nowait) + if (imp->imp_obd->obd_force) GOTO(set_state, rc); switch (imp->imp_connect_op) { - case OST_CONNECT: rq_opc = OST_DISCONNECT; break; - case MDS_CONNECT: rq_opc = MDS_DISCONNECT; break; - case MGS_CONNECT: rq_opc = MGS_DISCONNECT; break; + case OST_CONNECT: + rq_opc = OST_DISCONNECT; + break; + case MDS_CONNECT: + rq_opc = MDS_DISCONNECT; + break; + case MGS_CONNECT: + rq_opc = MGS_DISCONNECT; + break; default: - CERROR("don't know how to disconnect from %s (connect_op %d)\n", - obd2cli_tgt(imp->imp_obd), imp->imp_connect_op); - return -EINVAL; + rc = -EINVAL; + CERROR("%s: don't know how to disconnect from %s " + "(connect_op %d): rc = %d\n", + imp->imp_obd->obd_name, obd2cli_tgt(imp->imp_obd), + imp->imp_connect_op, rc); + return rc; } if (ptlrpc_import_in_recovery(imp)) { struct l_wait_info lwi; cfs_duration_t timeout; - if (AT_OFF) { if (imp->imp_server_timeout) timeout = cfs_time_seconds(obd_timeout / 2); @@ -1446,7 +1453,6 @@ int ptlrpc_disconnect_import(struct obd_import *imp, int noclose) spin_lock(&imp->imp_lock); if (imp->imp_state != LUSTRE_IMP_FULL) GOTO(out, 0); - spin_unlock(&imp->imp_lock); req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_DISCONNECT, @@ -1479,6 +1485,9 @@ out: memset(&imp->imp_remote_handle, 0, sizeof(imp->imp_remote_handle)); spin_unlock(&imp->imp_lock); + if (rc == -ETIMEDOUT || rc == -ENOTCONN || rc == -ESHUTDOWN) + rc = 0; + return rc; } EXPORT_SYMBOL(ptlrpc_disconnect_import); diff --git a/drivers/staging/lustre/lustre/ptlrpc/recover.c b/drivers/staging/lustre/lustre/ptlrpc/recover.c index 48ae328..4cff2f7 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/recover.c +++ b/drivers/staging/lustre/lustre/ptlrpc/recover.c @@ -369,11 +369,14 @@ EXPORT_SYMBOL(ptlrpc_recover_import); int ptlrpc_import_in_recovery(struct obd_import *imp) { int in_recovery = 1; + spin_lock(&imp->imp_lock); if (imp->imp_state == LUSTRE_IMP_FULL || imp->imp_state == LUSTRE_IMP_CLOSED || - imp->imp_state == LUSTRE_IMP_DISCON) + imp->imp_state == LUSTRE_IMP_DISCON || + imp->imp_obd->obd_no_recov) in_recovery = 0; spin_unlock(&imp->imp_lock); + return in_recovery; } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/47] staging/lustre/gss: Shared key mechanism & flavors
From: Andrew Korty Implement security flavors and GSSAPI mechanism to perform shared key authentication (ski) and encryption (skpi). Signed-off-by: Andrew Korty Reviewed-on: http://review.whamcloud.com/8629 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3289 Reviewed-by: Andreas Dilger Reviewed-by: Ken Hornstein Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_sec.h | 17 ++ drivers/staging/lustre/lustre/ptlrpc/gss/Makefile | 3 +- .../lustre/lustre/ptlrpc/gss/gss_internal.h| 3 + .../staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c | 226 + drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 8 + 6 files changed, 263 insertions(+), 2 deletions(-) create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index 40d463f..e46c0e5 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -103,6 +103,7 @@ enum sptlrpc_mech_plain { enum sptlrpc_mech_gss { SPTLRPC_MECH_GSS_NULL = 0, SPTLRPC_MECH_GSS_KRB5 = 1, + SPTLRPC_MECH_GSS_SK = 2, SPTLRPC_MECH_GSS_MAX, }; @@ -180,6 +181,10 @@ enum sptlrpc_bulk_service { MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_INTG) #define SPTLRPC_SUBFLVR_KRB5P \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_PRIV) +#define SPTLRPC_SUBFLVR_SKI \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_SK, SPTLRPC_SVC_INTG) +#define SPTLRPC_SUBFLVR_SKPI\ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_SK, SPTLRPC_SVC_PRIV) /* * "end user" flavors @@ -226,6 +231,18 @@ enum sptlrpc_bulk_service { SPTLRPC_SVC_PRIV, \ SPTLRPC_BULK_DEFAULT, \ SPTLRPC_BULK_SVC_PRIV) +#define SPTLRPC_FLVR_SKI\ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_SK, \ + SPTLRPC_SVC_INTG, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_PRIV) +#define SPTLRPC_FLVR_SKPI \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_SK, \ + SPTLRPC_SVC_PRIV, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_PRIV) #define SPTLRPC_FLVR_DEFAULT SPTLRPC_FLVR_NULL diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile b/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile index ab16596..bf16b97 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile @@ -2,7 +2,8 @@ obj-$(CONFIG_LUSTRE_FS) := ptlrpc_gss.o ptlrpc_gss-y := sec_gss.o gss_bulk.o gss_cli_upcall.o gss_svc_upcall.o \ gss_rawobj.o lproc_gss.o gss_generic_token.o\ - gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o + gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o \ + gss_sk_mech.o ccflags-y := -I$(src)/../include diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h index 1a0c7d5..a693a4a 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h @@ -506,6 +506,9 @@ void cleanup_null_module(void); int __init init_kerberos_module(void); void __exit cleanup_kerberos_module(void); +/* gss_sk_mech.c */ +int __init init_sk_module(void); +void cleanup_sk_module(void); /* debug */ static inline diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c new file mode 100644 index 000..df31b18 --- /dev/null +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_sk_mech.c @@ -0,0 +1,226 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy
[PATCH 03/47] staging/lustre/gss: gssnull security flavor
From: Andrew Korty This change implements the gssnull security flavor for the purpose of testing the Lustre GSS code. It provides and uses a null GSS mechanism so this testing doesn't have to involve any code related to Kerberos or any other authentication method. Signed-off-by: Andrew Korty Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3289 Reviewed-on: http://review.whamcloud.com/8475 Reviewed-by: Andreas Dilger Reviewed-by: Thomas Stibor Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_sec.h | 8 + drivers/staging/lustre/lustre/ptlrpc/gss/Makefile | 2 +- .../lustre/lustre/ptlrpc/gss/gss_internal.h| 4 + .../lustre/lustre/ptlrpc/gss/gss_null_mech.c | 195 + drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 8 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 + 6 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index bf3ee39..40d463f 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -170,6 +170,8 @@ enum sptlrpc_bulk_service { ((__u32)(mech) |\ ((__u32)(svc) << (FLVR_SVC_OFFSET - FLVR_MECH_OFFSET))) +#define SPTLRPC_SUBFLVR_GSSNULL \ + MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_NULL, SPTLRPC_SVC_NULL) #define SPTLRPC_SUBFLVR_KRB5N \ MAKE_BASE_SUBFLVR(SPTLRPC_MECH_GSS_KRB5, SPTLRPC_SVC_NULL) #define SPTLRPC_SUBFLVR_KRB5A \ @@ -194,6 +196,12 @@ enum sptlrpc_bulk_service { SPTLRPC_SVC_NULL, \ SPTLRPC_BULK_HASH,\ SPTLRPC_BULK_SVC_INTG) +#define SPTLRPC_FLVR_GSSNULL \ + MAKE_FLVR(SPTLRPC_POLICY_GSS, \ + SPTLRPC_MECH_GSS_NULL,\ + SPTLRPC_SVC_NULL, \ + SPTLRPC_BULK_DEFAULT, \ + SPTLRPC_BULK_SVC_NULL) #define SPTLRPC_FLVR_KRB5N \ MAKE_FLVR(SPTLRPC_POLICY_GSS, \ SPTLRPC_MECH_GSS_KRB5,\ diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile b/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile index 8cdfbee..ab16596 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/Makefile @@ -2,7 +2,7 @@ obj-$(CONFIG_LUSTRE_FS) := ptlrpc_gss.o ptlrpc_gss-y := sec_gss.o gss_bulk.o gss_cli_upcall.o gss_svc_upcall.o \ gss_rawobj.o lproc_gss.o gss_generic_token.o\ - gss_mech_switch.o gss_krb5_mech.o + gss_mech_switch.o gss_krb5_mech.o gss_null_mech.o ccflags-y := -I$(src)/../include diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h index cbfc47c..1a0c7d5 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_internal.h @@ -498,6 +498,10 @@ void gss_stat_oos_record_svc(int phase, int replay); int __init gss_init_lproc(void); void __exit gss_exit_lproc(void); +/* gss_null_mech.c */ +int __init init_null_module(void); +void cleanup_null_module(void); + /* gss_krb5_mech.c */ int __init init_kerberos_module(void); void __exit cleanup_kerberos_module(void); diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c new file mode 100644 index 000..3021d7d --- /dev/null +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_null_mech.c @@ -0,0 +1,195 @@ +/* + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.gnu.org/licenses/gpl-2.0.html + * + * GPL HEADER END + */ +/* + * Copyright (C) 2013, Trustees of Indiana University + * Author: Andrew Korty + */ + +#define DEBUG_SUBSYSTEM S_SEC +#include
[PATCH 08/47] staging/lustre/clio: clear nowait flag agl lock re-enqueue
From: Niu Yawei The LDLM_FL_BLOCK_NOWAIT flag should be cleared when re-enqueue the agl lock as normal glimpse, otherwise, it won't get size back if there is conflicting locks on other client. Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/9249 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4597 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Reviewed-by: Ned Bass Reviewed-by: Fan Yong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/osc/osc_lock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/osc/osc_lock.c b/drivers/staging/lustre/lustre/osc/osc_lock.c index ef7b9c2..1c6cafa 100644 --- a/drivers/staging/lustre/lustre/osc/osc_lock.c +++ b/drivers/staging/lustre/lustre/osc/osc_lock.c @@ -1192,6 +1192,7 @@ static int osc_lock_wait(const struct lu_env *env, LASSERT(olck->ols_agl); olck->ols_agl = 0; + olck->ols_flags &= ~LDLM_FL_BLOCK_NOWAIT; rc = osc_lock_enqueue(env, slice, NULL, CEF_ASYNC | CEF_MUST); if (rc != 0) return rc; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/47] staging/lustre/osc: don't activate deactivated obd_import
From: Hongchao Zhang In ptlrpc_activate_import(), obd_import->imp_deactive should be checked if it is deactivated, otherwise it will trigger an LBUG in ptlrpc_invalidate_import(): ptlrpc_invalidate_import() ASSERTION(imp->imp_invalid) failed Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/8747 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4386 Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/import.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c b/drivers/staging/lustre/lustre/ptlrpc/import.c index 537aa62..a04a1cc 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/import.c +++ b/drivers/staging/lustre/lustre/ptlrpc/import.c @@ -381,6 +381,11 @@ void ptlrpc_activate_import(struct obd_import *imp) struct obd_device *obd = imp->imp_obd; spin_lock(&imp->imp_lock); + if (imp->imp_deactive != 0) { + spin_unlock(&imp->imp_lock); + return; + } + imp->imp_invalid = 0; spin_unlock(&imp->imp_lock); obd_import_event(obd, imp, IMP_EVENT_ACTIVE); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/47] Lustre fixes and cleanups
add CPU table functions for uniprocessor staging/lustre: remove assertion of spin_is_locked() Liang Zhen (1): staging/lustre/lnet: NI shutdown may loop forever Matt Ezell (1): staging/lustre/lnet: Dropped messages are not accounted correctly Niu Yawei (1): staging/lustre/clio: clear nowait flag agl lock re-enqueue Oleg Drokin (1): staging/lustre: Fix unsafe userspace access in many proc files Patrick Farrell (1): staging/lustre/ptlrpc: Fix assertion failure of null_alloc_rs() Peng Tao (1): staging/lustre/hsm: count NULL terminator in hai_zero/hal_size Ryan Haasken (2): staging/lustre/llite: Do not rate limit dirty page discard warning staging/lustre: Always clamp cdls_delay between min and max Swapnil Pimpale (1): staging/lustre/osc: Update inode timestamp for lockless IO as well wang di (1): staging/lustre/mdc: use cl_max_mds_md to pack getattr RPC .../lustre/include/linux/libcfs/libcfs_cpu.h | 5 + .../lustre/include/linux/libcfs/libcfs_private.h | 4 +- .../lustre/include/linux/libcfs/linux/linux-lock.h | 2 +- .../lustre/include/linux/libcfs/linux/linux-mem.h | 5 + .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 2 +- .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 +- .../staging/lustre/lnet/klnds/socklnd/socklnd.c| 4 +- drivers/staging/lustre/lnet/lnet/api-ni.c | 15 +- drivers/staging/lustre/lnet/lnet/router.c | 3 +- drivers/staging/lustre/lnet/selftest/conctl.c | 11 +- drivers/staging/lustre/lnet/selftest/framework.c | 14 +- drivers/staging/lustre/lustre/fid/lproc_fid.c | 41 +++- drivers/staging/lustre/lustre/include/dt_object.h | 9 +- drivers/staging/lustre/lustre/include/ioctl.h | 106 drivers/staging/lustre/lustre/include/lu_object.h | 8 +- .../lustre/lustre/include/lustre/lustre_idl.h | 28 ++- .../lustre/lustre/include/lustre/lustre_user.h | 5 +- .../staging/lustre/lustre/include/lustre_debug.h | 1 - drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_lib.h | 13 - drivers/staging/lustre/lustre/include/lustre_log.h | 10 - drivers/staging/lustre/lustre/include/lustre_mdc.h | 23 +- drivers/staging/lustre/lustre/include/lustre_net.h | 4 +- drivers/staging/lustre/lustre/include/lustre_sec.h | 25 ++ drivers/staging/lustre/lustre/include/obd.h| 24 +- drivers/staging/lustre/lustre/include/obd_class.h | 16 +- drivers/staging/lustre/lustre/include/obd_lov.h| 116 - .../staging/lustre/lustre/include/obd_support.h| 10 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 17 +- .../staging/lustre/lustre/lclient/lcommon_misc.c | 15 +- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c | 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 4 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 10 +- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 21 ++ .../staging/lustre/lustre/libcfs/linux/linux-cpu.c | 18 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 12 +- drivers/staging/lustre/lustre/libcfs/tracefile.c | 10 +- drivers/staging/lustre/lustre/llite/dcache.c | 26 +- drivers/staging/lustre/lustre/llite/dir.c | 15 +- drivers/staging/lustre/lustre/llite/file.c | 148 ++- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 177 -- drivers/staging/lustre/lustre/llite/llite_lib.c| 135 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 23 +- drivers/staging/lustre/lustre/llite/llite_nfs.c| 4 +- drivers/staging/lustre/lustre/llite/lloop.c| 10 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 149 +-- drivers/staging/lustre/lustre/llite/namei.c| 40 +-- drivers/staging/lustre/lustre/llite/remote_perm.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 7 - drivers/staging/lustre/lustre/llite/rw26.c | 15 +- drivers/staging/lustre/lustre/llite/statahead.c| 68 +++--- drivers/staging/lustre/lustre/llite/super25.c | 9 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 10 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 4 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 35 ++- drivers/staging/lustre/lustre/llite/xattr.c| 5 + drivers/staging/lustre/lustre/llite/xattr_cache.c | 4 +- drivers/staging/lustre/lustre/lmv/lmv_obd.c| 25 +- drivers/staging/lustre/lustre/lov/Makefile | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c| 6 +- drivers/staging/lustre/lustre/lov/lov_ea.c | 14 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 37 ++- drivers/staging/lustre/lustre/lov/lov_lock.c | 42 +--- drivers/staging/lustre/lustr
[PATCH 12/47] staging/lustre: restore __GFP_WAIT flag to memalloc calls
From: Ann Koehler In Lustre 2.4, the flags passed to the memory allocation functions are translated from CFS enumeration values types to the kernel GFP values by calling cfs_alloc_flags_to_gfp(). This function adds __GFP_WAIT to all flags except CFS_ALLOC_ATOMIC. In 2.5, when the cfs wrappers were dropped, cfs_alloc_flags_to_gfp() was removed and the CFS_ALLOC_ was simply replaced with __GFP_. This means that most memory allocation calls are missing the __GFP_WAIT flag. The result is that Lustre experiences more ENOMEM errors, many of which the higher levels of Lustre do not handle robustly. Notes GFP_NOFS = __GFP_WAIT | __GFP_IO. So the patch replaces __GFP_IO with GFP_NOFS. Patch does not add __GFP_WAIT to GFP_IOFS. GFP_IOFS was not used in Lustre 2.4 so it has never been used with __GFP_WAIT. Signed-off-by: Ann Koehler Signed-off-by: Emoly Liu Reviewed-on: http://review.whamcloud.com/9223 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4357 Reviewed-by: Liang Zhen Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- .../staging/lustre/include/linux/libcfs/libcfs_private.h| 4 ++-- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c | 2 +- drivers/staging/lustre/lustre/include/obd_class.h | 2 +- drivers/staging/lustre/lustre/include/obd_support.h | 10 +- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 13 ++--- drivers/staging/lustre/lustre/ldlm/ldlm_extent.c| 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 6 +++--- drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 2 +- drivers/staging/lustre/lustre/llite/super25.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 4 ++-- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- drivers/staging/lustre/lustre/lov/lov_dev.c | 6 +++--- drivers/staging/lustre/lustre/lov/lov_ea.c | 2 +- drivers/staging/lustre/lustre/lov/lov_lock.c| 6 +++--- drivers/staging/lustre/lustre/lov/lov_object.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_dev.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_lock.c | 2 +- drivers/staging/lustre/lustre/lov/lovsub_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_lock.c| 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_page.c| 2 +- drivers/staging/lustre/lustre/obdclass/genops.c | 2 +- drivers/staging/lustre/lustre/obdecho/echo_client.c | 8 drivers/staging/lustre/lustre/osc/osc_dev.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_io.c | 2 +- drivers/staging/lustre/lustre/osc/osc_lock.c| 2 +- drivers/staging/lustre/lustre/osc/osc_object.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/client.c | 6 +++--- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 2 +- 33 files changed, 57 insertions(+), 58 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h index dddccca1..740bfcd 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h @@ -153,7 +153,7 @@ do { \ * default allocator */ #define LIBCFS_ALLOC(ptr, size) \ - LIBCFS_ALLOC_GFP(ptr, size, __GFP_IO) + LIBCFS_ALLOC_GFP(ptr, size, GFP_NOFS) /** * non-sleeping allocator @@ -177,7 +177,7 @@ do { \ /** default numa allocator */ #define LIBCFS_CPT_ALLOC(ptr, cptab, cpt, size) \ - LIBCFS_CPT_ALLOC_GFP(ptr, cptab, cpt, size, __GFP_IO) + LIBCFS_CPT_ALLOC_GFP(ptr, cptab, cpt, size, GFP_NOFS) #define LIBCFS_FREE(ptr, size) \ do { \ diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c index 0061c8a..892c419 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c @@ -1141,7 +1141,7 @@ kiblnd_alloc_pages(kib_pages_t **pp, int cpt, int npages) for (i = 0; i < npages; i++) { p->ibp_pages[i] = alloc_page
[PATCH 13/47] staging/lustre/gss: fix uninitialized variable
From: Dmitry Eremin 'sg->page_link' is used uninitialized in many functions. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9325 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: James Simmons Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c index d03f6c1..2cc78b0 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -525,6 +525,7 @@ void gss_delete_sec_context_kerberos(void *internal_ctx) static void buf_to_sg(struct scatterlist *sg, void *ptr, int len) { + sg_init_table(sg, 1); sg_set_buf(sg, ptr, len); } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/47] staging/lustre: quiet console permission error messages
From: Andreas Dilger Quiet some common console error messages for permission errors that can be hit in common cases. Signed-off-by: Andreas Dilger Reviewed-on: http://review.whamcloud.com/8988 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4522 Reviewed-by: Jinshan Xiong Reviewed-by: Faccini Bruno Reviewed-by: Bob Glossman Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/file.c| 7 --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 5 - 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index d01c864..c991ea5 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2882,9 +2882,10 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc) if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) return 0; } else if (rc != 0) { - CERROR("%s: revalidate FID "DFID" error: rc = %d\n", - ll_get_fsname(inode->i_sb, NULL, 0), - PFID(ll_inode2fid(inode)), rc); + CDEBUG_LIMIT((rc == -EACCES || rc == -EIDRM) ? D_INFO : D_ERROR, +"%s: revalidate FID "DFID" error: rc = %d\n", +ll_get_fsname(inode->i_sb, NULL, 0), +PFID(ll_inode2fid(inode)), rc); } return rc; diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 53022ec..f86f697 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -893,7 +893,10 @@ resend: mdc_put_rpc_lock(obddev->u.cli.cl_rpc_lock, it); if (rc < 0) { - CERROR("ldlm_cli_enqueue: %d\n", rc); + CDEBUG_LIMIT((rc == -EACCES || rc == -EIDRM) ? D_INFO : D_ERROR, +"%s: ldlm_cli_enqueue failed: rc = %d\n", +obddev->obd_name, rc); + mdc_clear_replay_flag(req, rc); ptlrpc_req_finished(req); return rc; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/47] staging/lustre/hsm: count NULL terminator in hai_zero/hal_size
From: Peng Tao If fsname is 8-byte aligned, hai_zero fails to count the ending NULL terminator causing hai to directly attached after fsname and future hai_zero will return a different position for first hai. Signed-off-by: Peng Tao Reviewed-on: http://review.whamcloud.com/9431 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4689 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre/lustre_user.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h index f5f369e..95c754f 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_user.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_user.h @@ -1106,7 +1106,8 @@ static inline struct hsm_action_item * hai_zero(struct hsm_action_list *hal) { return (struct hsm_action_item *)(hal->hal_fsname + cfs_size_round(strlen(hal-> \ - hal_fsname))); + hal_fsname) ++ 1)); } /* Return pointer to next hai */ static inline struct hsm_action_item * hai_next(struct hsm_action_item *hai) @@ -1121,7 +1122,7 @@ static inline int hal_size(struct hsm_action_list *hal) int i, sz; struct hsm_action_item *hai; - sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname)); + sz = sizeof(*hal) + cfs_size_round(strlen(hal->hal_fsname) + 1); hai = hai_zero(hal); for (i = 0; i < hal->hal_count; i++, hai = hai_next(hai)) sz += cfs_size_round(hai->hai_len); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/47] staging/lustre/lov: remove unused lov llog code
From: "John L. Hammond" Remove the unused functions lov_llog_init(), lov_llog_finish(), their supporting functions, and the file lov_log.c. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/8539 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/Makefile | 2 +- drivers/staging/lustre/lustre/lov/lov_internal.h | 4 - drivers/staging/lustre/lustre/lov/lov_log.c | 272 --- drivers/staging/lustre/lustre/lov/lov_obd.c | 9 +- 4 files changed, 3 insertions(+), 284 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/lov/lov_log.c diff --git a/drivers/staging/lustre/lustre/lov/Makefile b/drivers/staging/lustre/lustre/lov/Makefile index 9a5f26d..a908edb 100644 --- a/drivers/staging/lustre/lustre/lov/Makefile +++ b/drivers/staging/lustre/lustre/lov/Makefile @@ -1,5 +1,5 @@ obj-$(CONFIG_LUSTRE_FS) += lov.o -lov-y := lov_log.o lov_obd.o lov_pack.o lov_offset.o lov_merge.o \ +lov-y := lov_obd.o lov_pack.o lov_offset.o lov_merge.o \ lov_request.o lov_ea.o lov_dev.o lov_object.o lov_page.o \ lov_lock.o lov_io.o lovsub_dev.o lovsub_object.o lovsub_page.o \ lovsub_lock.o lovsub_io.o lov_pool.o diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index 2b22a03..10e18c2 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -251,10 +251,6 @@ int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg, __u32 *indexp, int *genp); int lov_del_target(struct obd_device *obd, __u32 index, struct obd_uuid *uuidp, int gen); -/* lov_log.c */ -int lov_llog_init(struct obd_device *obd, struct obd_llog_group *olg, - struct obd_device *tgt, int *idx); -int lov_llog_finish(struct obd_device *obd, int count); /* lov_pack.c */ int lov_packmd(struct obd_export *exp, struct lov_mds_md **lmm, diff --git a/drivers/staging/lustre/lustre/lov/lov_log.c b/drivers/staging/lustre/lustre/lov/lov_log.c deleted file mode 100644 index 3eedd93..000 --- a/drivers/staging/lustre/lustre/lov/lov_log.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - * - * Copyright (c) 2012, Intel Corporation. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/lov/lov_log.c - * - * Author: Phil Schwan - * Author: Peter Braam - * Author: Mike Shaver - */ - -#define DEBUG_SUBSYSTEM S_LOV -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "lov_internal.h" - -/* Add log records for each OSC that this object is striped over, and return - * cookies for each one. We _would_ have nice abstraction here, except that - * we need to keep cookies in stripe order, even if some are NULL, so that - * the right cookies are passed back to the right OSTs at the client side. - * Unset cookies should be all-zero (which will never occur naturally). */ -static int lov_llog_origin_add(const struct lu_env *env, - struct llog_ctxt *ctxt, - struct llog_rec_hdr *rec, - struct lov_stripe_md *lsm, - struct llog_cookie *logcookies, int numcookies) -{ - struct obd_device *obd = ctxt->loc_obd; - struct lov_obd *lov = &obd->u.lov; - int i, rc = 0, cookies = 0; - - LASSERTF(logcookies && numcookies >= lsm->lsm_stripe_count, -"logcookies %p, numcookies %d lsm->
[PATCH 11/47] staging/lustre/ptlrpc: add rpc_cache
From: Andriy Skulysh Add rpc_cache for allocating ptlrpc_requests. Xyratex-bug-id: MRP-689 Signed-off-by: Andriy Skulysh Signed-off-by: Niu Yawei Reviewed-on: http://review.whamcloud.com/6874 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2424 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/client.c | 42 ++ drivers/staging/lustre/lustre/ptlrpc/events.c | 2 +- .../staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 4 +++ .../staging/lustre/lustre/ptlrpc/ptlrpc_module.c | 32 - drivers/staging/lustre/lustre/ptlrpc/sec.c | 10 +++--- drivers/staging/lustre/lustre/ptlrpc/service.c | 13 --- 6 files changed, 75 insertions(+), 28 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c index 4c9e006..5bee820 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/client.c +++ b/drivers/staging/lustre/lustre/ptlrpc/client.c @@ -379,6 +379,34 @@ static int ptlrpc_at_recv_early_reply(struct ptlrpc_request *req) return rc; } +struct kmem_cache *request_cache; + +int ptlrpc_request_cache_init(void) +{ + request_cache = kmem_cache_create("ptlrpc_cache", + sizeof(struct ptlrpc_request), + 0, SLAB_HWCACHE_ALIGN, NULL); + return request_cache == NULL ? -ENOMEM : 0; +} + +void ptlrpc_request_cache_fini(void) +{ + kmem_cache_destroy(request_cache); +} + +struct ptlrpc_request *ptlrpc_request_cache_alloc(int flags) +{ + struct ptlrpc_request *req; + + OBD_SLAB_ALLOC_PTR_GFP(req, request_cache, flags); + return req; +} + +void ptlrpc_request_cache_free(struct ptlrpc_request *req) +{ + OBD_SLAB_FREE_PTR(req, request_cache); +} + /** * Wind down request pool \a pool. * Frees all requests from the pool too @@ -397,7 +425,7 @@ void ptlrpc_free_rq_pool(struct ptlrpc_request_pool *pool) LASSERT(req->rq_reqbuf); LASSERT(req->rq_reqbuf_len == pool->prp_rq_size); OBD_FREE_LARGE(req->rq_reqbuf, pool->prp_rq_size); - OBD_FREE(req, sizeof(*req)); + ptlrpc_request_cache_free(req); } spin_unlock(&pool->prp_lock); OBD_FREE(pool, sizeof(*pool)); @@ -427,12 +455,12 @@ void ptlrpc_add_rqs_to_pool(struct ptlrpc_request_pool *pool, int num_rq) struct lustre_msg *msg; spin_unlock(&pool->prp_lock); - OBD_ALLOC(req, sizeof(struct ptlrpc_request)); + req = ptlrpc_request_cache_alloc(__GFP_IO); if (!req) return; OBD_ALLOC_LARGE(msg, size); if (!msg) { - OBD_FREE(req, sizeof(struct ptlrpc_request)); + ptlrpc_request_cache_free(req); return; } req->rq_reqbuf = msg; @@ -668,7 +696,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct obd_import *imp, request = ptlrpc_prep_req_from_pool(pool); if (!request) - OBD_ALLOC_PTR(request); + request = ptlrpc_request_cache_alloc(__GFP_IO); if (request) { LASSERTF((unsigned long)imp > 0x1000, "%p", imp); @@ -739,7 +767,7 @@ void ptlrpc_request_free(struct ptlrpc_request *request) if (request->rq_pool) __ptlrpc_free_req_to_pool(request); else - OBD_FREE_PTR(request); + ptlrpc_request_cache_free(request); } EXPORT_SYMBOL(ptlrpc_request_free); @@ -2233,7 +2261,7 @@ static void __ptlrpc_free_req(struct ptlrpc_request *request, int locked) if (request->rq_pool) __ptlrpc_free_req_to_pool(request); else - OBD_FREE(request, sizeof(*request)); + ptlrpc_request_cache_free(request); } static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked); @@ -3023,7 +3051,7 @@ void *ptlrpcd_alloc_work(struct obd_import *imp, return ERR_PTR(-EINVAL); /* copy some code from deprecated fakereq. */ - OBD_ALLOC_PTR(req); + req = ptlrpc_request_cache_alloc(__GFP_IO); if (req == NULL) { CERROR("ptlrpc: run out of memory!\n"); return ERR_PTR(-ENOMEM); diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c b/drivers/staging/lustre/lustre/ptlrpc/events.c index 6ea0a49..aa85239 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/events.c +++ b/drivers/staging/lustre/lustre/ptlrpc/events.c @@ -307,7 +307,7 @@ void request_in_callback(lnet_event_t *ev) /* We moaned above already... */ return; } -
[PATCH 07/47] staging/lustre/ldlm: Hold lock when clearing flag
From: Li Xi This patch moves lock's skip flag clearing from lru-delete to lru-add code to prevent clearing lock's flag without resource lock protection. Signed-off-by: Li Xi Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/8772 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4269 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c index 0548aca..1066e00 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c @@ -232,8 +232,6 @@ int ldlm_lock_remove_from_lru_nolock(struct ldlm_lock *lock) LASSERT(lock->l_resource->lr_type != LDLM_FLOCK); list_del_init(&lock->l_lru); - if (lock->l_flags & LDLM_FL_SKIPPED) - lock->l_flags &= ~LDLM_FL_SKIPPED; LASSERT(ns->ns_nr_unused > 0); ns->ns_nr_unused--; rc = 1; @@ -271,6 +269,8 @@ void ldlm_lock_add_to_lru_nolock(struct ldlm_lock *lock) LASSERT(list_empty(&lock->l_lru)); LASSERT(lock->l_resource->lr_type != LDLM_FLOCK); list_add_tail(&lock->l_lru, &ns->ns_unused_list); + if (lock->l_flags & LDLM_FL_SKIPPED) + lock->l_flags &= ~LDLM_FL_SKIPPED; LASSERT(ns->ns_nr_unused >= 0); ns->ns_nr_unused++; } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/47] staging/lustre/llite: issue OST_SYNC for fsync()
From: Bobi Jam The last parameter @datasync of fsync() has following indication: * if datasync=0, we'd always flush data and metadata * if datasync=1, we'd always flush data while does not flush modifed metadata unless that metadata is needed in order to allow a subsequent data retrieval to be correctly handled. For example, a change to the file size would require a metadata flush. Lustre client can not tell the difference easily, and would issue MDS_SYNC and OST_SYNC in all cases. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/8684 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index c991ea5..872c878 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2653,7 +2653,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) if (!err) ptlrpc_req_finished(req); - if (datasync && S_ISREG(inode->i_mode)) { + if (S_ISREG(inode->i_mode)) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); err = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/47] staging/lustre/hsm: HSM requests not delivered
From: James Nunez The total size of an HSM archive request may exceed the desired (LNET) message. When this happens, it can hang the client and not allow the archive request to succeed. Before we know the total size of the hsm_action_items, we need to limit the size of the reguest. Doing this limits the number of items that can be sent in one archive request. We'e reduced the size allowed for the user archive request to MDS_MAXREQSIZE/3. Signed-off-by: James Nunez Reviewed-on: http://review.whamcloud.com/9393 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4639 Reviewed-by: John L. Hammond Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_net.h | 2 ++ drivers/staging/lustre/lustre/llite/dir.c | 5 + 2 files changed, 7 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 745adbb..7640e17 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -264,6 +264,8 @@ #define LDLM_MAXREQSIZE (5 * 1024) #define LDLM_MAXREPSIZE (1024) +#define MDS_MAXREQSIZE (5 * 1024) /* >= 4736 */ + #define OST_MAXREQSIZE (5 * 1024) /* Macro to hide a typecast. */ diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 7fbc18e..c391b60 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1804,6 +1804,11 @@ out_rmdir: /* Compute the whole struct size */ totalsize = hur_len(hur); OBD_FREE_PTR(hur); + + /* Final size will be more than double totalsize */ + if (totalsize >= MDS_MAXREQSIZE / 3) + return -E2BIG; + OBD_ALLOC_LARGE(hur, totalsize); if (hur == NULL) return -ENOMEM; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/47] staging/lustre/llite: Avoid statahead thread start/stop deadlocks
From: "Christopher J. Morrone" The statahead and statahead agl threads blindly set their thread state to SVC_RUNNING without checking the state first. If, for instance, another thread sets the state to SVC_STOPPING that stop signal will now have been lost. Deadlock ensues. We also partly improve the sai reference counting, because a race exists where the ll_stop_statahead thread can drop the default reference, and the statahead thread can exit and drop its reference as well. With no references on the sai, the final put will poison and free the buffer. The original do_statahead_enter() function may then continue to access the buffer after it is freed because it did not take a reference of its own. We add a local reference to address that. Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/9358 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4624 Reviewed-by: Lai Siyao Reviewed-by: Fan Yong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/statahead.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index c8624b5..74d95b0 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -964,7 +964,11 @@ static int ll_agl_thread(void *arg) atomic_inc(&sbi->ll_agl_total); spin_lock(&plli->lli_agl_lock); sai->sai_agl_valid = 1; - thread_set_flags(thread, SVC_RUNNING); + if (thread_is_init(thread)) + /* If someone else has changed the thread state +* (e.g. already changed to SVC_STOPPING), we can't just +* blindly overwrite that setting. */ + thread_set_flags(thread, SVC_RUNNING); spin_unlock(&plli->lli_agl_lock); wake_up(&thread->t_ctl_waitq); @@ -1058,7 +1062,11 @@ static int ll_statahead_thread(void *arg) atomic_inc(&sbi->ll_sa_total); spin_lock(&plli->lli_sa_lock); - thread_set_flags(thread, SVC_RUNNING); + if (thread_is_init(thread)) + /* If someone else has changed the thread state +* (e.g. already changed to SVC_STOPPING), we can't just +* blindly overwrite that setting. */ + thread_set_flags(thread, SVC_RUNNING); spin_unlock(&plli->lli_sa_lock); wake_up(&thread->t_ctl_waitq); @@ -1658,6 +1666,12 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, CDEBUG(D_READA, "start statahead thread: [pid %d] [parent %.*s]\n", current_pid(), parent->d_name.len, parent->d_name.name); + /* The sai buffer already has one reference taken at allocation time, +* but as soon as we expose the sai by attaching it to the lli that +* default reference can be dropped by another thread calling +* ll_stop_statahead. We need to take a local reference to protect +* the sai buffer while we intend to access it. */ + ll_sai_get(sai); lli->lli_sai = sai; plli = ll_i2info(parent->d_inode); @@ -1670,6 +1684,9 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, lli->lli_opendir_key = NULL; thread_set_flags(thread, SVC_STOPPED); thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED); + /* Drop both our own local reference and the default +* reference from allocation time. */ + ll_sai_put(sai); ll_sai_put(sai); LASSERT(lli->lli_sai == NULL); return -EAGAIN; @@ -1678,6 +1695,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, l_wait_event(thread->t_ctl_waitq, thread_is_running(thread) || thread_is_stopped(thread), &lwi); + ll_sai_put(sai); /* * We don't stat-ahead for the first dirent since we are already in -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/47] staging/lustre/llite: deadlock taking lli_trunc_sem during file write
From: Bobi Jam File write before io loop will take lli_trun_sem read semaphore to protect osc_extent, while after generic_file_aio_write() done, it could possible need to kill suid or sgid, which will call ll_setattr_raw() to change the inode's attribute, and it does not involve size. So the ll_truc_sem write semaphore should be constrained around ll_setattr_ost() to not come across the lli_trunc_sem read semaphore get from the normal file write path. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/9267 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4627 Reviewed-by: Lai Siyao Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/llite_lib.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 7c4fd97..373a24f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -1449,7 +1449,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) if (attr->ia_valid & ATTR_SIZE) inode_dio_write_done(inode); mutex_unlock(&inode->i_mutex); - down_write(&lli->lli_trunc_sem); } memcpy(&op_data->op_attr, attr, sizeof(*attr)); @@ -1513,7 +1512,11 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import) * excessive to send mtime/atime updates to OSTs when not * setting times to past, but it is necessary due to possible * time de-synchronization between MDT inode and OST objects */ + if (attr->ia_valid & ATTR_SIZE) + down_write(&lli->lli_trunc_sem); rc = ll_setattr_ost(inode, attr); + if (attr->ia_valid & ATTR_SIZE) + up_write(&lli->lli_trunc_sem); out: if (op_data) { if (op_data->op_ioepoch) { @@ -1524,7 +1527,6 @@ out: ll_finish_md_op_data(op_data); } if (!S_ISDIR(inode->i_mode)) { - up_write(&lli->lli_trunc_sem); mutex_lock(&inode->i_mutex); if ((attr->ia_valid & ATTR_SIZE) && !hsm_import) inode_dio_wait(inode); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/47] staging/lustre/gss: fix few issues found by Klocwork Insight tool
From: Dmitry Eremin Array 'message_buf' of size 500 may use index value(s) -1 Object 'enc_key.data' was freed at line 164 after being freed by calling 'free' at line 150. Also there are 3 similar errors on line(s) 164. Suspicious dereference of pointer 'vmsg' before NULL check at line 187. Also there are 2 similar errors on line(s) 196, 205. Suspicious dereference of pointer 'rmsg' before NULL check at line 191. Also there are 2 similar errors on line(s) 200, 209. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9274 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c index 7852bf3..93794bd 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c +++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_bulk.c @@ -176,31 +176,31 @@ int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, switch (SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc)) { case SPTLRPC_SVC_NULL: vmsg = req->rq_repdata; + LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 3); voff = vmsg->lm_bufcount - 1; - LASSERT(vmsg && vmsg->lm_bufcount >= 3); rmsg = req->rq_reqbuf; + LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 3); roff = rmsg->lm_bufcount - 1; /* last segment */ - LASSERT(rmsg && rmsg->lm_bufcount >= 3); break; case SPTLRPC_SVC_AUTH: case SPTLRPC_SVC_INTG: vmsg = req->rq_repdata; + LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 4); voff = vmsg->lm_bufcount - 2; - LASSERT(vmsg && vmsg->lm_bufcount >= 4); rmsg = req->rq_reqbuf; + LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 4); roff = rmsg->lm_bufcount - 2; /* second last segment */ - LASSERT(rmsg && rmsg->lm_bufcount >= 4); break; case SPTLRPC_SVC_PRIV: vmsg = req->rq_repdata; + LASSERT(vmsg != NULL && vmsg->lm_bufcount >= 2); voff = vmsg->lm_bufcount - 1; - LASSERT(vmsg && vmsg->lm_bufcount >= 2); rmsg = req->rq_clrbuf; + LASSERT(rmsg != NULL && rmsg->lm_bufcount >= 2); roff = rmsg->lm_bufcount - 1; /* last segment */ - LASSERT(rmsg && rmsg->lm_bufcount >= 2); break; default: LBUG(); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/47] staging/lustre/ldlm: fix NULL pointer dereference
From: Dmitry Eremin Pointer '*exp' returned from call to function 'class_conn2export' at line 523 may be NULL and may be dereferenced at line 543. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9323 ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 1a8c0d7..42f5f1e 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -514,7 +514,7 @@ int client_connect_import(const struct lu_env *env, LASSERT (imp->imp_state == LUSTRE_IMP_DISCON); GOTO(out_ldlm, rc); } - LASSERT((*exp)->exp_connection); + LASSERT(*exp != NULL && (*exp)->exp_connection); if (data) { LASSERTF((ocd->ocd_connect_flags & data->ocd_connect_flags) == -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 32/47] staging/lustre/lnet: NI shutdown may loop forever
From: Liang Zhen lnet_shutdown_lndnis() may enter endless loop if there is a busy NI, this is injected by LNet SMP improvements. It's fixed in this patch. Signed-off-by: Liang Zhen Reviewed-on: http://review.whamcloud.com/9706 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4780 Reviewed-by: Isaac Huang Reviewed-by: Bobi Jam Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/api-ni.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index f5a9ae3..3f1fdaa 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -986,12 +986,11 @@ lnet_shutdown_lndnis (void) break; } - while (!list_empty(&ni->ni_list)) { + if (!list_empty(&ni->ni_list)) { lnet_net_unlock(LNET_LOCK_EX); ++i; if ((i & (-i)) == i) { - CDEBUG(D_WARNING, - "Waiting for zombie LNI %s\n", + CDEBUG(D_WARNING, "Waiting for zombie LNI %s\n", libcfs_nid2str(ni->ni_nid)); } set_current_state(TASK_UNINTERRUPTIBLE); @@ -1016,6 +1015,8 @@ lnet_shutdown_lndnis (void) libcfs_nid2str(ni->ni_nid)); lnet_ni_free(ni); + i = 2; + lnet_net_lock(LNET_LOCK_EX); } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/47] staging/lustre/llite: access layout version under a lock
From: Jinshan Xiong We used to access layout version under the protection of ldlm lock, this introduces extra overhead for dlm lock matching. In this patch, lli_layout_lock is introduced to access the layout version. Also, when a layout lock is losing, we should tear down mmap of the correspoding inode to avoid stale data accessing in the future. This is part of technical verification of replication. Signed-off-by: Jinshan Xiong Reviewed-on: http://review.whamcloud.com/8689 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3254 Reviewed-by: Lai Siyao Reviewed-by: Bobi Jam Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/file.c | 22 --- .../staging/lustre/lustre/llite/llite_internal.h | 21 ++- drivers/staging/lustre/lustre/llite/llite_lib.c| 3 ++- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 31 -- 5 files changed, 51 insertions(+), 28 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 166321c..e3bc2b0 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -3436,7 +3436,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, ldlm_mode_t mode, if (lvb_ready) { /* layout_gen must be valid if layout lock is not * cancelled and stripe has already set */ - *gen = lli->lli_layout_gen; + *gen = ll_layout_version_get(lli); rc = 0; } GOTO(out, rc); @@ -3534,32 +3534,20 @@ int ll_layout_refresh(struct inode *inode, __u32 *gen) }; int rc; - *gen = lli->lli_layout_gen; - if (!(sbi->ll_flags & LL_SBI_LAYOUT_LOCK)) + *gen = ll_layout_version_get(lli); + if (!(sbi->ll_flags & LL_SBI_LAYOUT_LOCK) || *gen != LL_LAYOUT_GEN_NONE) return 0; /* sanity checks */ LASSERT(fid_is_sane(ll_inode2fid(inode))); LASSERT(S_ISREG(inode->i_mode)); - /* mostly layout lock is caching on the local side, so try to match -* it before grabbing layout lock mutex. */ - mode = ll_take_md_lock(inode, MDS_INODELOCK_LAYOUT, &lockh, 0, - LCK_CR | LCK_CW | LCK_PR | LCK_PW); - if (mode != 0) { /* hit cached lock */ - rc = ll_layout_lock_set(&lockh, mode, inode, gen, false); - if (rc == 0) - return 0; - - /* better hold lli_layout_mutex to try again otherwise -* it will have starvation problem. */ - } - /* take layout lock mutex to enqueue layout lock exclusively. */ mutex_lock(&lli->lli_layout_mutex); again: - /* try again. Maybe somebody else has done this. */ + /* mostly layout lock is caching on the local side, so try to match +* it before grabbing layout lock mutex. */ mode = ll_take_md_lock(inode, MDS_INODELOCK_LAYOUT, &lockh, 0, LCK_CR | LCK_CW | LCK_PR | LCK_PW); if (mode != 0) { /* hit cached lock */ diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index 4663e82..d2f8250 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -280,14 +280,33 @@ struct ll_inode_info { /* mutex to request for layout lock exclusively. */ struct mutexlli_layout_mutex; - /* valid only inside LAYOUT ibits lock, protected by lli_layout_mutex */ + /* Layout version, protected by lli_layout_lock */ __u32 lli_layout_gen; + spinlock_t lli_layout_lock; struct rw_semaphore lli_xattrs_list_rwsem; struct mutexlli_xattrs_enq_lock; struct list_headlli_xattrs;/* ll_xattr_entry->xe_list */ }; +static inline __u32 ll_layout_version_get(struct ll_inode_info *lli) +{ + __u32 gen; + + spin_lock(&lli->lli_layout_lock); + gen = lli->lli_layout_gen; + spin_unlock(&lli->lli_layout_lock); + + return gen; +} + +static inline void ll_layout_version_set(struct ll_inode_info *lli, __u32 gen) +{ + spin_lock(&lli->lli_layout_lock); + lli->lli_layout_gen = gen; + spin_unlock(&lli->lli_layout_lock); +} + int ll_xattr_cache_destroy(struct inode *inode); int ll_xattr_cache_get(struct inode *inode, diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 582fafc..befc30b 100644 --- a/drivers/staging/lustre/lustre/llite/lli
[PATCH 37/47] staging/lustre/llite: Do not rate limit dirty page discard warning
From: Ryan Haasken Messages which are printed by ll_dirty_page_discard_warn() should not be rate limited. If they are rate limited, some files which may be corrupted on client eviction will not be reported to the user. This patch changes the CWARN to a CDEBUG to disable console message rate limiting for this message. The dirty page discard warnings are already limited on a per-file basis by the function vvp_vmpage_error which calls ll_dirty_page_discard_warn only if the ccc_object's cob_discard_page_warned == 0. Signed-off-by: Ryan Haasken Reviewed-on: http://review.whamcloud.com/9752 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4799 Reviewed-by: Cory Spitz Reviewed-by: Ann Koehler Reviewed-by: Chris Horn Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/llite_lib.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 34df5d9..dbb1413 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -2456,11 +2456,12 @@ void ll_dirty_page_discard_warn(struct page *page, int ioret) path = ll_d_path(dentry, buf, PAGE_SIZE); } - CWARN("%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted " - "(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0), - s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev, - PFID(&obj->cob_header.coh_lu.loh_fid), - (path && !IS_ERR(path)) ? path : "", ioret); + CDEBUG(D_WARNING, + "%s: dirty page discard: %s/fid: "DFID"/%s may get corrupted " + "(rc %d)\n", ll_get_fsname(page->mapping->host->i_sb, NULL, 0), + s2lsi(page->mapping->host->i_sb)->lsi_lmd->lmd_dev, + PFID(&obj->cob_header.coh_lu.loh_fid), + (path && !IS_ERR(path)) ? path : "", ioret); if (dentry != NULL) dput(dentry); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/47] stagaing/lustre: Improve statahead debug messages
From: "Christopher J. Morrone" The statahead debug messages include the pid of the current process in their body. This is both redudant (because all lustre log messages contain the pid), and sometimes downright misleading. For instance the messages would say something like "stopping statahead thread 3446". One would probably think that 3446 is the pid of the process that is being stopped, but in fact it was the pid of the caller issuing the stop signal. We remove all superfluous pids from the messages. Next we have the ll_statahead_thread() and the ll_agl_thread() record their respective pids in their respective ptlrpc_thread structures. This allows to print the pid of the thread that we are trying to stop (which is actually useful info) from other threads, such as those calling ll_stop_statahead(). Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/9360 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4624 Reviewed-by: Fan Yong Reviewed-by: Lai Siyao Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/statahead.c | 38 + 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index 74d95b0..51c5327 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c @@ -958,8 +958,9 @@ static int ll_agl_thread(void *arg) struct ptlrpc_thread *thread = &sai->sai_agl_thread; struct l_wait_info lwi= { 0 }; - CDEBUG(D_READA, "agl thread started: [pid %d] [parent %.*s]\n", - current_pid(), parent->d_name.len, parent->d_name.name); + thread->t_pid = current_pid(); + CDEBUG(D_READA, "agl thread started: sai %p, parent %.*s\n", + sai, parent->d_name.len, parent->d_name.name); atomic_inc(&sbi->ll_agl_total); spin_lock(&plli->lli_agl_lock); @@ -1008,8 +1009,8 @@ static int ll_agl_thread(void *arg) spin_unlock(&plli->lli_agl_lock); wake_up(&thread->t_ctl_waitq); ll_sai_put(sai); - CDEBUG(D_READA, "agl thread stopped: [pid %d] [parent %.*s]\n", - current_pid(), parent->d_name.len, parent->d_name.name); + CDEBUG(D_READA, "agl thread stopped: sai %p, parent %.*s\n", + sai, parent->d_name.len, parent->d_name.name); return 0; } @@ -1020,8 +1021,8 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) struct ll_inode_info *plli; struct task_struct *task; - CDEBUG(D_READA, "start agl thread: [pid %d] [parent %.*s]\n", - current_pid(), parent->d_name.len, parent->d_name.name); + CDEBUG(D_READA, "start agl thread: sai %p, parent %.*s\n", + sai, parent->d_name.len, parent->d_name.name); plli = ll_i2info(parent->d_inode); task = kthread_run(ll_agl_thread, parent, @@ -1054,8 +1055,9 @@ static int ll_statahead_thread(void *arg) struct ll_dir_chain chain; struct l_wait_info lwi= { 0 }; - CDEBUG(D_READA, "statahead thread started: [pid %d] [parent %.*s]\n", - current_pid(), parent->d_name.len, parent->d_name.name); + thread->t_pid = current_pid(); + CDEBUG(D_READA, "statahead thread starting: sai %p, parent %.*s\n", + sai, parent->d_name.len, parent->d_name.name); if (sbi->ll_flags & LL_SBI_AGL_ENABLED) ll_start_agl(parent, sai); @@ -1247,8 +1249,8 @@ out: spin_unlock(&plli->lli_agl_lock); wake_up(&agl_thread->t_ctl_waitq); - CDEBUG(D_READA, "stop agl thread: [pid %d]\n", - current_pid()); + CDEBUG(D_READA, "stop agl thread: sai %p pid %u\n", + sai, (unsigned int)agl_thread->t_pid); l_wait_event(agl_thread->t_ctl_waitq, thread_is_stopped(agl_thread), &lwi); @@ -1274,8 +1276,8 @@ out: wake_up(&thread->t_ctl_waitq); ll_sai_put(sai); dput(parent); - CDEBUG(D_READA, "statahead thread stopped: [pid %d] [parent %.*s]\n", - current_pid(), parent->d_name.len, parent->d_name.name); + CDEBUG(D_READA, "statahead thread stopped: sai %p, parent %.*s\n", + sai, parent->d_name.len, parent->d_name.name); return rc; } @@ -1306,8 +1308,8 @@ void ll_stop_statahead(struct inode *dir, void *key) spin_unlock(&lli->lli_sa_lock); wake_up(&thread->
[PATCH 34/47] staging/lustre/libcfs: add CPU table functions for uniprocessor
From: Li Xi Some CPU table functions for uniprocessor architecture is missing. Signed-off-by: Li Xi Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/8873 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199 Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Reviewed-by: Liang Zhen Reviewed-by: Oleg Drokin --- .../lustre/include/linux/libcfs/libcfs_cpu.h| 5 + .../lustre/include/linux/libcfs/linux/linux-mem.h | 5 + drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c | 21 + 3 files changed, 31 insertions(+) diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h index d116fdf..a140e5d 100644 --- a/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_cpu.h @@ -203,6 +203,11 @@ void cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt); int cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt); /** + * return number of HTs in the same core of \a cpu + */ +int cfs_cpu_ht_nsiblings(int cpu); + +/** * iterate over all CPU partitions in \a cptab */ #define cfs_cpt_for_each(i, cptab) \ diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h index 2af15d4..72c76ad 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-mem.h @@ -53,6 +53,11 @@ #include #include +#ifndef HAVE_LIBCFS_CPT +/* Need this for cfs_cpt_table */ +#include +#endif + #define CFS_PAGE_MASK (~((__u64)PAGE_CACHE_SIZE-1)) #define page_index(p) ((p)->index) diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c index 1fb3700..d985e83 100644 --- a/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/libcfs_cpu.c @@ -75,6 +75,20 @@ cfs_cpt_table_free(struct cfs_cpt_table *cptab) EXPORT_SYMBOL(cfs_cpt_table_free); int +cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len) +{ + int rc = 0; + + rc = snprintf(buf, len, "%d\t: %d\n", 0, 0); + len -= rc; + if (len <= 0) + return -EFBIG; + + return rc; +} +EXPORT_SYMBOL(cfs_cpt_table_print); + +int cfs_cpt_number(struct cfs_cpt_table *cptab) { return 1; @@ -161,6 +175,13 @@ cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt) EXPORT_SYMBOL(cfs_cpt_spread_node); int +cfs_cpu_ht_nsiblings(int cpu) +{ + return 1; +} +EXPORT_SYMBOL(cfs_cpu_ht_nsiblings); + +int cfs_cpt_current(struct cfs_cpt_table *cptab, int remap) { return 0; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 38/47] staging/lustre/lloop: avoid panic during blockdev_info
From: Bob Glossman Change the LL_IOC_LLOOP_INFO ioctl in the lustre lloop device driver to return an error instead of causing panics with LASSERT(). Signed-off-by: Bob Glossman Reviewed-on: http://review.whamcloud.com/9888 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4863 Reviewed-by: Nathaniel Clark Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/lloop.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/lloop.c b/drivers/staging/lustre/lustre/llite/lloop.c index f78eda2..437adaf 100644 --- a/drivers/staging/lustre/lustre/llite/lloop.c +++ b/drivers/staging/lustre/lustre/llite/lloop.c @@ -624,7 +624,10 @@ static int lo_ioctl(struct block_device *bdev, fmode_t mode, case LL_IOC_LLOOP_INFO: { struct lu_fid fid; - LASSERT(lo->lo_backing_file != NULL); + if (lo->lo_backing_file == NULL) { + err = -ENOENT; + break; + } if (inode == NULL) inode = lo->lo_backing_file->f_dentry->d_inode; if (lo->lo_state == LLOOP_BOUND) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/47] staging/lustre: Limit reply buffer size
From: Brian Behlendorf When allocating a reply buffer for the striping information don't assume the unlikely worst case. Instead, assume the common case and size the buffer based on the observed default ea/cookie size. The default size is initialized to a single stripe and allowed to grow up to an entire page if needed. This means that for smallish filesystems (less than ~21 OSTs) where the worst case striping information can fit in a single page there is effectively no change. Only for larger filesystem will the default be less than the maximum. This has a number of advantages. * By limiting the default reply buffer size we avoid always vmalloc()'ing the buffer because it exceeds four pages in size and instead kmalloc() it. This prevents the client from thrashing on the global vmalloc() spin lock. * A reply buffer of exactly the right size (no larger) is allocated in the overflow case. These larger reply buffers are still unlikely to exceed the 16k limit where a vmalloc() will occur. * Saves memory in the common case. Wide striped files exceeded the default are expected to be the exception. The reason this patch works is because the ptlrpc layer is smart enough to reallocate the reply buffer when an overflow occurs. Therefore the client doesn't have to drop the incoming reply and send a new request with a larger reply buffer. It's also worth mentioning that the reply buffer always contains a significant amount of extra padding because they are rounded up to the nearest power of two. This means that even files striped wider than the default have a good chance of fitting in the allocated reply buffer. Also remove client eadatasize check in mdt xattr packing because as said above client can handle -EOVERFLOW. Signed-off-by: Brian Behlendorf Signed-off-by: Lai Siyao Reviewed-on: http://review.whamcloud.com/6339 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3338 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_mdc.h | 23 ++--- drivers/staging/lustre/lustre/include/obd.h| 15 -- drivers/staging/lustre/lustre/include/obd_class.h | 5 +- .../staging/lustre/lustre/lclient/lcommon_misc.c | 15 -- drivers/staging/lustre/lustre/llite/dir.c | 2 +- drivers/staging/lustre/lustre/llite/file.c | 8 ++-- .../staging/lustre/lustre/llite/llite_internal.h | 8 ++-- drivers/staging/lustre/lustre/llite/llite_lib.c| 39 drivers/staging/lustre/lustre/llite/llite_nfs.c| 4 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 54 -- drivers/staging/lustre/lustre/lmv/lmv_obd.c| 25 ++ drivers/staging/lustre/lustre/mdc/mdc_locks.c | 10 ++-- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 8 ++-- drivers/staging/lustre/lustre/mdc/mdc_request.c| 49 +--- 14 files changed, 206 insertions(+), 59 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_mdc.h b/drivers/staging/lustre/lustre/include/lustre_mdc.h index 468f363..66765d4 100644 --- a/drivers/staging/lustre/lustre/include/lustre_mdc.h +++ b/drivers/staging/lustre/lustre/include/lustre_mdc.h @@ -140,17 +140,26 @@ static inline void mdc_put_rpc_lock(struct mdc_rpc_lock *lck, mutex_unlock(&lck->rpcl_mutex); } +/* Update the maximum observed easize and cookiesize. The default easize + * and cookiesize is initialized to the minimum value but allowed to grow + * up to a single page in size if required to handle the common case. + */ static inline void mdc_update_max_ea_from_body(struct obd_export *exp, struct mdt_body *body) { if (body->valid & OBD_MD_FLMODEASIZE) { - if (exp->exp_obd->u.cli.cl_max_mds_easize < body->max_mdsize) - exp->exp_obd->u.cli.cl_max_mds_easize = - body->max_mdsize; - if (exp->exp_obd->u.cli.cl_max_mds_cookiesize < - body->max_cookiesize) - exp->exp_obd->u.cli.cl_max_mds_cookiesize = - body->max_cookiesize; + struct client_obd *cli = &exp->exp_obd->u.cli; + + if (cli->cl_max_mds_easize < body->max_mdsize) { + cli->cl_max_mds_easize = body->max_mdsize; + cli->cl_default_mds_easize = + min_t(__u32, body->max_mdsize, PAGE_CACHE_SIZE); + } + if (cli->cl_max_mds_cookiesize < body->max_cookiesize) { + cli->cl_max_mds_cookiesize = body->max_cookiesize; + cli->cl_default_mds_cookiesize = +
[PATCH 39/47] staging/lustre/clio: Solve a race in cl_lock_put
From: Jinshan Xiong It's not atomic to check the last reference and state of cl_lock in cl_lock_put(). This can cause a problem that an using lock is freed, if the process is preempted between atomic_dec_and_test() and (lock->cll_state == CLS_FREEING). This problem can be solved by holding a refcount by coh_locks. In this case, it can be sure that if the lock refcount reaches zero, nobody else can have any chance to use it again. Signed-off-by: Jinshan Xiong Reviewed-on: http://review.whamcloud.com/9881 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4558 Reviewed-by: Bobi Jam Reviewed-by: Lai Siyao Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index 918f433..f8040a8 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -533,6 +533,7 @@ static struct cl_lock *cl_lock_find(const struct lu_env *env, spin_lock(&head->coh_lock_guard); ghost = cl_lock_lookup(env, obj, io, need); if (ghost == NULL) { + cl_lock_get_trust(lock); list_add_tail(&lock->cll_linkage, &head->coh_locks); spin_unlock(&head->coh_lock_guard); @@ -791,15 +792,22 @@ static void cl_lock_delete0(const struct lu_env *env, struct cl_lock *lock) LINVRNT(cl_lock_invariant(env, lock)); if (lock->cll_state < CLS_FREEING) { + bool in_cache; + LASSERT(lock->cll_state != CLS_INTRANSIT); cl_lock_state_set(env, lock, CLS_FREEING); head = cl_object_header(lock->cll_descr.cld_obj); spin_lock(&head->coh_lock_guard); - list_del_init(&lock->cll_linkage); + in_cache = !list_empty(&lock->cll_linkage); + if (in_cache) + list_del_init(&lock->cll_linkage); spin_unlock(&head->coh_lock_guard); + if (in_cache) /* coh_locks cache holds a refcount. */ + cl_lock_put(env, lock); + /* * From now on, no new references to this lock can be acquired * by cl_lock_lookup(). -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 35/47] staging/lustre: replace semaphores with mutexes
From: Dmitry Eremin It's just optimization. The mutex subsystem is slightly faster and has better scalability for contended workloads. Remove the lustre_lock and it's accessor functions l_lock(), l_unlock(), l_lock_init(), and l_has_lock() since they have not been used by the code since Lustre 1.6. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9294 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4588 Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Alex Zhuravlev Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lustre_lib.h | 13 - drivers/staging/lustre/lustre/include/obd.h| 2 +- drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 2 +- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 16 drivers/staging/lustre/lustre/mgc/mgc_request.c| 8 5 files changed, 14 insertions(+), 27 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_lib.h b/drivers/staging/lustre/lustre/include/lustre_lib.h index 0368ca6..bdc9812 100644 --- a/drivers/staging/lustre/lustre/include/lustre_lib.h +++ b/drivers/staging/lustre/lustre/include/lustre_lib.h @@ -94,19 +94,6 @@ struct obd_client_handle { void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs); void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs); -/* l_lock.c */ -struct lustre_lock { - int l_depth; - struct task_struct *l_owner; - struct semaphorel_sem; - spinlock_t l_spin; -}; - -void l_lock_init(struct lustre_lock *); -void l_lock(struct lustre_lock *); -void l_unlock(struct lustre_lock *); -int l_has_lock(struct lustre_lock *); - /* * For md echo client */ diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 7ed5fcd..d5c4613 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -406,7 +406,7 @@ struct client_obd { struct mdc_rpc_lock *cl_close_lock; /* mgc datastruct */ - struct semaphore cl_mgc_sem; + struct mutex cl_mgc_mutex; struct local_oid_storage *cl_mgc_los; struct dt_object*cl_mgc_configs_dir; atomic_t cl_mgc_refcount; diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c index 42f5f1e..8bb5915 100644 --- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c @@ -325,7 +325,7 @@ int client_obd_setup(struct obd_device *obddev, struct lustre_cfg *lcfg) } init_rwsem(&cli->cl_sem); - sema_init(&cli->cl_mgc_sem, 1); + mutex_init(&cli->cl_mgc_mutex); cli->cl_conn_count = 0; memcpy(server_uuid.uuid, lustre_cfg_buf(lcfg, 2), min_t(unsigned int, LUSTRE_CFG_BUFLEN(lcfg, 2), diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index d169374..fc21210 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -71,7 +71,7 @@ struct cfs_cpt_data { /* reserved for hotplug */ unsigned long cpt_version; /* mutex to protect cpt_cpumask */ - struct semaphorecpt_mutex; + struct mutexcpt_mutex; /* scratch buffer for set/unset_node */ cpumask_t *cpt_cpumask; }; @@ -420,14 +420,14 @@ cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node) return 0; } - down(&cpt_data.cpt_mutex); + mutex_lock(&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask; cfs_node_to_cpumask(node, mask); rc = cfs_cpt_set_cpumask(cptab, cpt, mask); - up(&cpt_data.cpt_mutex); + mutex_unlock(&cpt_data.cpt_mutex); return rc; } @@ -444,14 +444,14 @@ cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node) return; } - down(&cpt_data.cpt_mutex); + mutex_lock(&cpt_data.cpt_mutex); mask = cpt_data.cpt_cpumask; cfs_node_to_cpumask(node, mask); cfs_cpt_unset_cpumask(cptab, cpt, mask); - up(&cpt_data.cpt_mutex); + mutex_unlock(&cpt_data.cpt_mutex); } EXPORT_SYMBOL(cfs_cpt_unset_node); @@ -969,11 +969,11 @@ cfs_cpu_notify(struct notifier_block *self, unsigned long action, void *hcpu) break; } - down(&cpt_data.cpt_mutex); + mutex_lock(&cpt_data.cpt_mutex); /* if all HTs in a core are offline, it may break affinity */ cfs_cpu_ht_siblings(cpu, cpt_data
[PATCH 16/47] staging/lustre/obdclass: remove uses of lov_stripe_md
From: "John L. Hammond" Remove the unused function llog_obd_add(). Remove the unused count and parameters from llog_cancel(). Move dump_lsm() from obdclass to the only module that uses it (lov). Remove obd_lov.h. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/8545 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-by: Bobi Jam Reviewed-by: Mike Pershin Signed-off-by: Oleg Drokin --- .../lustre/lustre/include/lustre/lustre_idl.h | 26 + .../staging/lustre/lustre/include/lustre_debug.h | 1 - drivers/staging/lustre/lustre/include/lustre_log.h | 10 -- drivers/staging/lustre/lustre/include/obd.h| 7 ++ drivers/staging/lustre/lustre/include/obd_class.h | 9 -- drivers/staging/lustre/lustre/include/obd_lov.h| 116 - drivers/staging/lustre/lustre/lov/lov_ea.c | 12 ++- drivers/staging/lustre/lustre/lov/lov_internal.h | 33 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 2 - drivers/staging/lustre/lustre/lov/lov_obd.c| 9 +- drivers/staging/lustre/lustre/lov/lov_object.c | 1 - drivers/staging/lustre/lustre/lov/lov_offset.c | 1 - drivers/staging/lustre/lustre/lov/lov_pack.c | 10 +- drivers/staging/lustre/lustre/lov/lov_request.c| 1 - drivers/staging/lustre/lustre/obdclass/debug.c | 12 --- drivers/staging/lustre/lustre/obdclass/llog_obd.c | 29 +- .../staging/lustre/lustre/obdecho/echo_client.c| 1 - drivers/staging/lustre/lustre/osc/osc_request.c| 1 - drivers/staging/lustre/lustre/ptlrpc/recover.c | 1 - 19 files changed, 85 insertions(+), 197 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/obd_lov.h diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index 87905bb..abd29bf 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -1682,6 +1682,30 @@ static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic) stripes * sizeof(struct lov_ost_data_v1); } +static inline __u32 +lov_mds_md_max_stripe_count(size_t buf_size, __u32 lmm_magic) +{ + switch (lmm_magic) { + case LOV_MAGIC_V1: { + struct lov_mds_md_v1 lmm; + + if (buf_size < sizeof(lmm)) + return 0; + + return (buf_size - sizeof(lmm)) / sizeof(lmm.lmm_objects[0]); + } + case LOV_MAGIC_V3: { + struct lov_mds_md_v3 lmm; + + if (buf_size < sizeof(lmm)) + return 0; + + return (buf_size - sizeof(lmm)) / sizeof(lmm.lmm_objects[0]); + } + default: + return 0; + } +} #define OBD_MD_FLID(0x0001ULL) /* object ID */ #define OBD_MD_FLATIME (0x0002ULL) /* access time */ @@ -2681,6 +2705,8 @@ enum seq_op { * protocol, this will limit the max number of OSTs per LOV */ #define LOV_DESC_MAGIC 0xB0CCDE5C +#define LOV_DESC_QOS_MAXAGE_DEFAULT 5 /* Seconds */ +#define LOV_DESC_STRIPE_SIZE_DEFAULT (1 << LNET_MTU_BITS) /* LOV settings descriptor (should only contain static info) */ struct lov_desc { diff --git a/drivers/staging/lustre/lustre/include/lustre_debug.h b/drivers/staging/lustre/lustre/include/lustre_debug.h index 7ec91ed..6146ccb 100644 --- a/drivers/staging/lustre/lustre/include/lustre_debug.h +++ b/drivers/staging/lustre/lustre/include/lustre_debug.h @@ -48,7 +48,6 @@ /* lib/debug.c */ void dump_lniobuf(struct niobuf_local *lnb); int dump_req(struct ptlrpc_request *req); -void dump_lsm(int level, struct lov_stripe_md *lsm); int block_debug_setup(void *addr, int len, __u64 off, __u64 id); int block_debug_check(char *who, void *addr, int len, __u64 off, __u64 id); diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h b/drivers/staging/lustre/lustre/include/lustre_log.h index 896c757..1a9a922 100644 --- a/drivers/staging/lustre/lustre/include/lustre_log.h +++ b/drivers/staging/lustre/lustre/include/lustre_log.h @@ -206,11 +206,7 @@ int llog_setup(const struct lu_env *env, struct obd_device *obd, int __llog_ctxt_put(const struct lu_env *env, struct llog_ctxt *ctxt); int llog_cleanup(const struct lu_env *env, struct llog_ctxt *); int llog_sync(struct llog_ctxt *ctxt, struct obd_export *exp, int flags); -int llog_obd_add(const struct lu_env *env, struct llog_ctxt *ctxt, -struct llog_rec_hdr *rec, struct lov_stripe_md *lsm, -struct llog_cookie *logcookies, int numcookies); int llog_cancel(const struct lu_env *env, struct llog_ctxt *ctxt, - struct lov_stripe_md *lsm, int count, struct llog_cookie *cookies, int flags); int obd_llog_init(struct obd_device *obd, struct obd_llog_group *olg, @@ -242,7 +238,6 @@ struct llog_operations {
[PATCH 33/47] staging/lustre: remove lustre/include/ioctl.h
From: "John L. Hammond" Remove the nowhere included header lustre/include/ioctl.h. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/9757 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-by: Bob Glossman Reviewed-by: Dmitry Eremin Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/ioctl.h | 106 -- 1 file changed, 106 deletions(-) delete mode 100644 drivers/staging/lustre/lustre/include/ioctl.h diff --git a/drivers/staging/lustre/lustre/include/ioctl.h b/drivers/staging/lustre/lustre/include/ioctl.h deleted file mode 100644 index b986920..000 --- a/drivers/staging/lustre/lustre/include/ioctl.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * GPL HEADER START - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 only, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License version 2 for more details (a copy is included - * in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU General Public License - * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. - * - * GPL HEADER END - */ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * Use is subject to license terms. - */ -/* - * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - */ - -#ifndef _IOWR - -/* On i386 and x86_64, _ASM_I386_IOCTL_H is defined by the kernel's ioctl.h, - * and on newer kernels this header is shared as _ASM_GENERIC_IOCTL_H. - * - * We can avoid any problems with the kernel header being included again by - * defining _ASM_I386_IOCTL_H here so that a later occurrence of - * does not include the kernel's ioctl.h after this one. b=14746 */ -#define _ASM_I386_IOCTL_H -#define _ASM_GENERIC_IOCTL_H - -/* ioctl command encoding: 32 bits total, command in lower 16 bits, - * size of the parameter structure in the lower 14 bits of the - * upper 16 bits. - * Encoding the size of the parameter structure in the ioctl request - * The highest 2 bits are reserved for indicating the ``access mode''. - * NOTE: This limits the max parameter size to 16kB -1 ! - */ - -/* - * The following is for compatibility across the various Linux - * platforms. The i386 ioctl numbering scheme doesn't really enforce - * a type field. De facto, however, the top 8 bits of the lower 16 - * bits are indeed used as a type field, so we might just as well make - * this explicit here. Please be sure to use the decoding macros - * below from now on. - */ -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS2 - -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK((1 << _IOC_DIRBITS)-1) - -#define _IOC_NRSHIFT0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -/* - * Direction bits. - */ -#define _IOC_NONE 0U -#define _IOC_WRITE 1U -#define _IOC_READ 2U - -#define _IOC(dir,type,nr,size) (((dir) << _IOC_DIRSHIFT) | ((type) << _IOC_TYPESHIFT) | ((nr) << _IOC_NRSHIFT) | ((size) << _IOC_SIZESHIFT)) - -/* used to create numbers */ -#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) - -/* used to decode ioctl numbers.. */ -#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK) -#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK) -#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK) -#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK) - -/* ...and for the drivers/sound files... */ - -#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT) -#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT) -#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT) -#define IOCSIZE_MASK(_IOC_SIZEMASK <<
[PATCH 36/47] staging/lustre/clio: replace semaphore with mutex
From: Dmitry Eremin According https://www.kernel.org/doc/Documentation/mutex-design.txt: - the mutex subsystem is slightly faster and has better scalability for contended workloads. In terms of 'ops per CPU cycle', the semaphore kernel performed 551 ops/sec per 1% of CPU time used, while the mutex kernel performed 3825 ops/sec per 1% of CPU time used - it was 6.9 times more efficient. - there are no fastpath tradeoffs, the mutex fastpath is just as tight as the semaphore fastpath. On x86, the locking fastpath is 2 instructions. - 'struct mutex' semantics are well-defined and are enforced if CONFIG_DEBUG_MUTEXES is turned on. Semaphores on the other hand have virtually no debugging code or instrumentation. One more benefit of mutex is optimistic spinning. It try to spin for acquisition when there are no pending waiters and the lock owner is currently running on a (different) CPU. The rationale is that if the lock owner is running, it is likely to release the lock soon. This significantly reduce amount of context switches when locked region is small and we have high contention. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9095 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4257 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/llite_internal.h | 10 -- drivers/staging/lustre/lustre/llite/llite_lib.c | 12 +++- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h index d2f8250..f4b15bf 100644 --- a/drivers/staging/lustre/lustre/llite/llite_internal.h +++ b/drivers/staging/lustre/lustre/llite/llite_internal.h @@ -211,8 +211,7 @@ struct ll_inode_info { /* for non-directory */ struct { - struct semaphoref_size_sem; - void*f_size_sem_owner; + struct mutexf_size_mutex; char*f_symlink_name; __u64 f_maxbytes; /* @@ -249,8 +248,7 @@ struct ll_inode_info { char f_jobid[JOBSTATS_JOBID_SIZE]; } f; -#define lli_size_sem u.f.f_size_sem -#define lli_size_sem_owner u.f.f_size_sem_owner +#define lli_size_mutex u.f.f_size_mutex #define lli_symlink_name u.f.f_symlink_name #define lli_maxbytes u.f.f_maxbytes #define lli_trunc_sem u.f.f_trunc_sem @@ -319,7 +317,7 @@ int ll_xattr_cache_get(struct inode *inode, * Locking to guarantee consistency of non-atomic updates to long long i_size, * consistency between file size and KMS. * - * Implemented by ->lli_size_sem and ->lsm_lock, nested in that order. + * Implemented by ->lli_size_mutex and ->lsm_lock, nested in that order. */ void ll_inode_size_lock(struct inode *inode); @@ -1448,7 +1446,7 @@ static inline void cl_isize_unlock(struct inode *inode) static inline void cl_isize_write_nolock(struct inode *inode, loff_t kms) { - LASSERT(down_trylock(&ll_i2info(inode)->lli_size_sem) != 0); + LASSERT(mutex_is_locked(&ll_i2info(inode)->lli_size_mutex)); i_size_write(inode, kms); } diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index befc30b..34df5d9 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -982,8 +982,7 @@ void ll_lli_init(struct ll_inode_info *lli) spin_lock_init(&lli->lli_sa_lock); lli->lli_opendir_pid = 0; } else { - sema_init(&lli->lli_size_sem, 1); - lli->lli_size_sem_owner = NULL; + mutex_init(&lli->lli_size_mutex); lli->lli_symlink_name = NULL; init_rwsem(&lli->lli_trunc_sem); mutex_init(&lli->lli_write_mutex); @@ -1700,10 +1699,7 @@ void ll_inode_size_lock(struct inode *inode) LASSERT(!S_ISDIR(inode->i_mode)); lli = ll_i2info(inode); - LASSERT(lli->lli_size_sem_owner != current); - down(&lli->lli_size_sem); - LASSERT(lli->lli_size_sem_owner == NULL); - lli->lli_size_sem_owner = current; + mutex_lock(&lli->lli_size_mutex); } void ll_inode_size_unlock(struct inode *inode) @@ -1711,9 +1707,7 @@ void ll_inode_size_unlock(struct inode *inode) struct ll_inode_info *lli; lli = ll_i2info(inode); - LASSERT(lli->lli_size_sem_owner == current); - lli->lli_size_sem_owner = NULL; - up(&lli->lli_size_se
[PATCH 44/47] staging/lustre: Always clamp cdls_delay between min and max
From: Ryan Haasken In libcfs_debug_vmsg2, cdls_delay is only clamped between the minimum and the maximum when it is increased by multiplying by the backoff factor. It is not clamped when it is decreased by dividing by the backoff factor. This allows it to achieve values less than the minimum, which allows a console message to be printed that should have been skipped. This patch moves the clamping outside of the else statement, ensuring that cdls_delay is always between the min and the max after the first time through libcfs_debug_vmsg2. Signed-off-by: Ryan Haasken Reviewed-on: http://review.whamcloud.com/9503 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4711 Reviewed-by: Chris Horn Reviewed-by: Ann Koehler Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/libcfs/tracefile.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/tracefile.c b/drivers/staging/lustre/lustre/libcfs/tracefile.c index 50d4218..07845e8 100644 --- a/drivers/staging/lustre/lustre/libcfs/tracefile.c +++ b/drivers/staging/lustre/lustre/libcfs/tracefile.c @@ -416,13 +416,13 @@ console: cdls->cdls_delay /= libcfs_console_backoff * 4; } else { cdls->cdls_delay *= libcfs_console_backoff; - - if (cdls->cdls_delay < libcfs_console_min_delay) - cdls->cdls_delay = libcfs_console_min_delay; - else if (cdls->cdls_delay > libcfs_console_max_delay) - cdls->cdls_delay = libcfs_console_max_delay; } + if (cdls->cdls_delay < libcfs_console_min_delay) + cdls->cdls_delay = libcfs_console_min_delay; + else if (cdls->cdls_delay > libcfs_console_max_delay) + cdls->cdls_delay = libcfs_console_max_delay; + /* ensure cdls_next is never zero after it's been seen */ cdls->cdls_next = (cfs_time_current() + cdls->cdls_delay) | 1; } -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 31/47] staging/lustre/libcfs: fix issues found by Klocwork Insight tool
From: Dmitry Eremin sscanf format specification '%u' expects type 'unsigned int *' for 'u', but parameter 3 has a different type 'int*'. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9400 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: James Simmons Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c | 2 +- drivers/staging/lustre/lustre/libcfs/nidstrings.c | 12 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c index 77b1ef6..d169374 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-cpu.c @@ -881,7 +881,7 @@ cfs_cpt_table_create_pattern(char *pattern) break; } - if (sscanf(str, "%u%n", &cpt, &n) < 1) { + if (sscanf(str, "%d%n", &cpt, &n) < 1) { CERROR("Invalid cpu pattern %s\n", str); goto failed; } diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c b/drivers/staging/lustre/lustre/libcfs/nidstrings.c index cfb274f..87705ae 100644 --- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c +++ b/drivers/staging/lustre/lustre/libcfs/nidstrings.c @@ -227,11 +227,11 @@ libcfs_ip_addr2str(__u32 addr, char *str) int libcfs_ip_str2addr(const char *str, int nob, __u32 *addr) { - int a; - int b; - int c; - int d; - int n = nob;/* XscanfX */ + unsigned inta; + unsigned intb; + unsigned intc; + unsigned intd; + int n = nob; /* XscanfX */ /* numeric IP? */ if (sscanf(str, "%u.%u.%u.%u%n", &a, &b, &c, &d, &n) >= 4 && @@ -419,7 +419,7 @@ libcfs_str2net_internal(const char *str, __u32 *net) { struct netstrfns *uninitialized_var(nf); intnob; - intnetnum; + unsigned int netnum; inti; for (i = 0; i < libcfs_nnetstrfns; i++) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 46/47] staging/lustre: Fix unsafe userspace access in many proc files
Apparently we are pretty bad about verifying our buffers passed from userspace. Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/9059 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4563 Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons --- drivers/staging/lustre/lustre/fid/lproc_fid.c | 41 +++--- .../lustre/lustre/include/lustre/lustre_idl.h | 2 +- drivers/staging/lustre/lustre/llite/lproc_llite.c | 91 +- .../lustre/lustre/obdclass/linux/linux-module.c| 9 ++- drivers/staging/lustre/lustre/osc/lproc_osc.c | 16 +++- 5 files changed, 124 insertions(+), 35 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/lproc_fid.c b/drivers/staging/lustre/lustre/fid/lproc_fid.c index ddd813c..6f5674d 100644 --- a/drivers/staging/lustre/lustre/fid/lproc_fid.c +++ b/drivers/staging/lustre/lustre/fid/lproc_fid.c @@ -54,32 +54,49 @@ #include #include "fid_internal.h" +/* Format: [0x64BIT_INT - 0x64BIT_INT] + 32 bytes just in case */ +#define MAX_FID_RANGE_STRLEN (32 + 2 * 2 * sizeof(__u64)) /* * Note: this function is only used for testing, it is no safe for production * use. */ -static int -lprocfs_fid_write_common(const char *buffer, unsigned long count, -struct lu_seq_range *range) +static int lprocfs_fid_write_common(const char __user *buffer, size_t count, + struct lu_seq_range *range) { struct lu_seq_range tmp; int rc; + char kernbuf[MAX_FID_RANGE_STRLEN]; LASSERT(range != NULL); - rc = sscanf(buffer, "[%llx - %llx]\n", + if (count >= sizeof(kernbuf)) + return -EINVAL; + + if (copy_from_user(kernbuf, buffer, count)) + return -EFAULT; + + kernbuf[count] = 0; + + if (count == 5 && strcmp(kernbuf, "clear") == 0) { + memset(range, 0, sizeof(*range)); + return count; + } + + /* of the form "[0x00024400 - 0x00028000400]" */ + rc = sscanf(kernbuf, "[%llx - %llx]\n", (long long unsigned *)&tmp.lsr_start, (long long unsigned *)&tmp.lsr_end); - if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp)) + if (!range_is_sane(&tmp) || range_is_zero(&tmp) || + tmp.lsr_start < range->lsr_start || tmp.lsr_end > range->lsr_end) return -EINVAL; *range = tmp; - return 0; + return count; } /* Client side procfs stuff */ -static ssize_t -lprocfs_fid_space_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +static ssize_t lprocfs_fid_space_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private; int rc; @@ -114,9 +131,9 @@ lprocfs_fid_space_seq_show(struct seq_file *m, void *unused) return rc; } -static ssize_t -lprocfs_fid_width_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +static ssize_t lprocfs_fid_width_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { struct lu_client_seq *seq = ((struct seq_file *)file->private_data)->private; __u64 max; diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index abd29bf..83014c9 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -265,7 +265,7 @@ static inline __u64 range_space(const struct lu_seq_range *range) static inline void range_init(struct lu_seq_range *range) { - range->lsr_start = range->lsr_end = range->lsr_index = 0; + memset(range, 0, sizeof(*range)); } /** diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c b/drivers/staging/lustre/lustre/llite/lproc_llite.c index 6d70c65..77ee9e5 100644 --- a/drivers/staging/lustre/lustre/llite/lproc_llite.c +++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c @@ -367,8 +367,9 @@ static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v) cache->ccc_lru_shrinkers); } -static ssize_t ll_max_cached_mb_seq_write(struct file *file, const char *buffer, - size_t count, loff_t *off) +static ssize_t ll_max_cached_mb_seq_write(struct file *file, + const char __user *buffer, + size_t count, loff_t *off) { struct supe
[PATCH 41/47] staging/lustre/llite: remove dead code
From: "John L. Hammond" In llite remove unused declarations, parameters, types, and unused, get-only, or set-only structure members. Add static and const qualifiers to declarations where possible. Signed-off-by: John L. Hammond Reviewed-on: http://review.whamcloud.com/9767 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-by: Lai Siyao Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 4 +- drivers/staging/lustre/lustre/llite/dcache.c | 26 ++-- drivers/staging/lustre/lustre/llite/dir.c | 8 +- drivers/staging/lustre/lustre/llite/file.c | 89 ++--- drivers/staging/lustre/lustre/llite/llite_capa.c | 4 +- .../staging/lustre/lustre/llite/llite_internal.h | 138 - drivers/staging/lustre/lustre/llite/llite_lib.c| 64 +- drivers/staging/lustre/lustre/llite/llite_mmap.c | 23 +--- drivers/staging/lustre/lustre/llite/lloop.c| 5 - drivers/staging/lustre/lustre/llite/lproc_llite.c | 4 +- drivers/staging/lustre/lustre/llite/namei.c| 40 ++ drivers/staging/lustre/lustre/llite/remote_perm.c | 2 +- drivers/staging/lustre/lustre/llite/rw.c | 7 -- drivers/staging/lustre/lustre/llite/rw26.c | 15 +-- drivers/staging/lustre/lustre/llite/statahead.c| 8 -- drivers/staging/lustre/lustre/llite/super25.c | 7 +- drivers/staging/lustre/lustre/llite/vvp_dev.c | 6 +- drivers/staging/lustre/lustre/llite/vvp_internal.h | 2 +- drivers/staging/lustre/lustre/llite/vvp_io.c | 2 +- drivers/staging/lustre/lustre/llite/vvp_object.c | 4 +- drivers/staging/lustre/lustre/llite/xattr_cache.c | 2 +- 21 files changed, 125 insertions(+), 335 deletions(-) diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c index 12812fc..dc24cfa 100644 --- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c +++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c @@ -63,7 +63,7 @@ #include "../llite/llite_internal.h" -const struct cl_req_operations ccc_req_ops; +static const struct cl_req_operations ccc_req_ops; /* * ccc_ prefix stands for "Common Client Code". @@ -962,7 +962,7 @@ void ccc_req_attr_set(const struct lu_env *env, JOBSTATS_JOBID_SIZE); } -const struct cl_req_operations ccc_req_ops = { +static const struct cl_req_operations ccc_req_ops = { .cro_attr_set = ccc_req_attr_set, .cro_completion = ccc_req_completion }; diff --git a/drivers/staging/lustre/lustre/llite/dcache.c b/drivers/staging/lustre/lustre/llite/dcache.c index 8b55080..7d520d8 100644 --- a/drivers/staging/lustre/lustre/llite/dcache.c +++ b/drivers/staging/lustre/lustre/llite/dcache.c @@ -69,8 +69,7 @@ static void ll_release(struct dentry *de) ll_intent_release(lld->lld_it); OBD_FREE(lld->lld_it, sizeof(*lld->lld_it)); } - LASSERT(lld->lld_cwd_count == 0); - LASSERT(lld->lld_mnt_count == 0); + de->d_fsdata = NULL; call_rcu(&lld->lld_rcu_head, free_dentry_data); } @@ -82,8 +81,9 @@ static void ll_release(struct dentry *de) * an AST before calling d_revalidate_it(). The dentry still exists (marked * INVALID) so d_lookup() matches it, but we have no lock on it (so * lock_match() fails) and we spin around real_lookup(). */ -int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, - unsigned int len, const char *str, const struct qstr *name) +static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, + unsigned int len, const char *str, + const struct qstr *name) { if (len != name->len) return 1; @@ -238,7 +238,8 @@ void ll_intent_release(struct lookup_intent *it) ll_intent_drop_lock(it); /* We are still holding extra reference on a request, need to free it */ if (it_disposition(it, DISP_ENQ_OPEN_REF)) -ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */ + ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */ + if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ ptlrpc_req_finished(it->d.lustre.it_data); @@ -316,15 +317,6 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) } } -void ll_frob_intent(struct lookup_intent **itp, struct lookup_intent *deft) -{ - struct lookup_intent *it = *itp; - - if (!it || it->it_op == IT_GETXATTR) - it = *itp = deft; - -} - static int ll_revalidate_dentry(struct dentry *dentry, unsigned int lookup_flags) { @@ -356,7 +348,7 @@ static int ll_revalidate_dentry(struct dentry *dentry, /* * Always trust cached dentries. Update s
[PATCH 19/47] staging/lustre: fix permission problem of setfacl
From: Li Xi Setxattr does not check the permission when setting ACL xattrs. This will cause security problem because any user can walk around permission checking by changing ACL rules. Signed-off-by: Li Xi Reviewed-on: http://review.whamcloud.com/9473 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4704 Reviewed-by: Andreas Dilger Reviewed-by: Bob Glossman Reviewed-by: John L. Hammond Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/xattr.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index b1ed4d9..67a1de4 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -124,6 +124,11 @@ int ll_setxattr_common(struct inode *inode, const char *name, if (rc) return rc; + if ((xattr_type == XATTR_ACL_ACCESS_T || +xattr_type == XATTR_ACL_DEFAULT_T) && + !inode_owner_or_capable(inode)) + return -EPERM; + /* b10667: ignore lustre special xattr for now */ if ((xattr_type == XATTR_TRUSTED_T && strcmp(name, "trusted.lov") == 0) || (xattr_type == XATTR_LUSTRE_T && strcmp(name, "lustre.lov") == 0)) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/47] staging/lustre/mdc: fix issue found by Klocwork Insight tool
From: Dmitry Eremin Pointer 'mod' checked for NULL at line 160 may be dereferenced at line 208. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9387 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: Lai Siyao Reviewed-by: John L. Hammond Reviewed-by: Fan Yong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_reint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c index 19f20c1..08e8094 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c @@ -199,7 +199,8 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data, *request = req; if (rc && req->rq_commit_cb) { /* Put an extra reference on \var mod on error case. */ - obd_mod_put(*mod); + if (mod != NULL && *mod != NULL) + obd_mod_put(*mod); req->rq_commit_cb(req); } return rc; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 40/47] staging/lustre/mdc: use cl_max_mds_md to pack getattr RPC
From: wang di In some cases, cl_default_mds_easize might be zero, especially for MDC connected to non-MDT0, then mdc might pack getattr RPC with zero eadatasize. If client is trying to access remote striped directory with zero eadatasize, MDT will not return layout information of the striped direcotry, which will be mis-regarded as non-striped directory. So we should use cl_max_mds_easize if cl_default_mds_easize is zero. Signed-off-by: wang di Reviewed-on: http://review.whamcloud.com/9862 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4847 Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_locks.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 41a18f5..1a8cd98 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c @@ -462,6 +462,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, OBD_MD_FLRMTPERM : OBD_MD_FLACL); struct ldlm_intent*lit; int rc; + int easize; req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_INTENT_GETATTR); @@ -482,12 +483,15 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp, lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT); lit->opc = (__u64)it->it_op; + if (obddev->u.cli.cl_default_mds_easize > 0) + easize = obddev->u.cli.cl_default_mds_easize; + else + easize = obddev->u.cli.cl_max_mds_easize; + /* pack the intended request */ - mdc_getattr_pack(req, valid, it->it_flags, op_data, -obddev->u.cli.cl_default_mds_easize); + mdc_getattr_pack(req, valid, it->it_flags, op_data, easize); - req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, -obddev->u.cli.cl_default_mds_easize); + req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, easize); if (client_is_remote(exp)) req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, sizeof(struct mdt_remote_perm)); -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 45/47] staging/lustre: pass fsync() range through RPC/IO stack
From: Andreas Dilger The Linux VFS and Lustre OST_SYNC RPC are both capable of specifying fsync() on a sub-extent of the file {start, end} instead of the full file. This allows less than the full amount of data to be flushed, reducing or possibly eliminating the work needed before the syscall can return. However, the handling of sub-extent of the file for fsync was lost with the move to CLIO on the client and OSD API on the server. They were ignoring the passed {start, end} and using {0, OBD_OBJECT_EOF} instead. Return the ability to pass a sub-extent for fsync() from the client, to the specific stripes/OSTs that need the sync operation, and pass it down to the OSD. The ZFS OSD doesn't handle this yet, but there is room for improvement in a separate patch. Signed-off-by: Andreas Dilger Reviewed-on: http://review.whamcloud.com/8626 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388 Reviewed-by: Bobi Jam Reviewed-by: Jinshan Xiong Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/dt_object.h | 9 + drivers/staging/lustre/lustre/llite/file.c| 5 ++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/dt_object.h b/drivers/staging/lustre/lustre/include/dt_object.h index 9304c26..9b7921d 100644 --- a/drivers/staging/lustre/lustre/include/dt_object.h +++ b/drivers/staging/lustre/lustre/include/dt_object.h @@ -441,7 +441,8 @@ struct dt_object_operations { struct dt_object *dt, struct lustre_capa *old, __u64 opc); - int (*do_object_sync)(const struct lu_env *, struct dt_object *); + int (*do_object_sync)(const struct lu_env *env, struct dt_object *obj, + __u64 start, __u64 end); /** * Get object info of next level. Currently, only get inode from osd. * This is only used by quota b=16542 @@ -900,13 +901,13 @@ static inline int dt_object_lock(const struct lu_env *env, int dt_lookup_dir(const struct lu_env *env, struct dt_object *dir, const char *name, struct lu_fid *fid); -static inline int dt_object_sync(const struct lu_env *env, -struct dt_object *o) +static inline int dt_object_sync(const struct lu_env *env, struct dt_object *o, +__u64 start, __u64 end) { LASSERT(o); LASSERT(o->do_ops); LASSERT(o->do_ops->do_object_sync); - return o->do_ops->do_object_sync(env, o); + return o->do_ops->do_object_sync(env, o, start, end); } int dt_declare_version_set(const struct lu_env *env, struct dt_object *o, diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 4d8f6a0..79accc5 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -2570,7 +2570,7 @@ static int ll_flush(struct file *file, fl_owner_t id) /** * Called to make sure a portion of file has been written out. - * if @local_only is not true, it will send OST_SYNC RPCs to ost. + * if @mode is not CL_FSYNC_LOCAL, it will send OST_SYNC RPCs to OST. * * Return how many pages have been written. */ @@ -2667,8 +2667,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync) if (S_ISREG(inode->i_mode)) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - err = cl_sync_file_range(inode, 0, OBD_OBJECT_EOF, - CL_FSYNC_ALL, 0); + err = cl_sync_file_range(inode, start, end, CL_FSYNC_ALL, 0); if (rc == 0 && err < 0) rc = err; if (rc < 0) -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/47] staging/lustre: shrink lu_object_header by 8 bytes on x86_64
From: Andreas Dilger Locate the loh_flags and loh_ref fields together in lu_object_header to avoid holes and shrink the structure by 8 bytes. Signed-off-by: Andreas Dilger Reviewed-on: http://review.whamcloud.com/9185 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3059 Reviewed-by: Alex Zhuravlev Reviewed-by: Liang Zhen Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/include/lu_object.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lu_object.h b/drivers/staging/lustre/lustre/include/lu_object.h index 6773bca..98149f5 100644 --- a/drivers/staging/lustre/lustre/include/lu_object.h +++ b/drivers/staging/lustre/lustre/include/lu_object.h @@ -516,6 +516,10 @@ enum lu_object_header_attr { */ struct lu_object_header { /** +* Fid, uniquely identifying this object. +*/ + struct lu_fid loh_fid; + /** * Object flags from enum lu_object_header_flags. Set and checked * atomically. */ @@ -525,10 +529,6 @@ struct lu_object_header { */ atomic_t loh_ref; /** -* Fid, uniquely identifying this object. -*/ - struct lu_fid loh_fid; - /** * Common object attributes, cached for efficiency. From enum * lu_object_header_attr. */ -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 42/47] staging/lustre: remove assertion of spin_is_locked()
From: Li Xi spin_is_locked() is always false when the platform is uniprocessor and CONFIG_DEBUG_SPINLOCK is not enabled. This patch replaces its assertion by assert_spin_locked(). Signed-off-by: Li Xi Signed-off-by: James Simmons Reviewed-on: http://review.whamcloud.com/8144 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4199 Reviewed-by: Alexey Lyashkov Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h | 2 +- drivers/staging/lustre/lustre/include/lustre_dlm.h | 2 +- drivers/staging/lustre/lustre/include/lustre_net.h | 2 +- drivers/staging/lustre/lustre/lov/lov_merge.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/cl_lock.c | 2 +- drivers/staging/lustre/lustre/obdclass/cl_object.c | 4 ++-- drivers/staging/lustre/lustre/obdclass/cl_page.c | 2 +- drivers/staging/lustre/lustre/osc/osc_cache.c | 4 ++-- drivers/staging/lustre/lustre/osc/osc_cl_internal.h| 9 + drivers/staging/lustre/lustre/ptlrpc/client.c | 8 +++- drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c | 4 ++-- drivers/staging/lustre/lustre/ptlrpc/import.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c| 2 +- drivers/staging/lustre/lustre/ptlrpc/pinger.c | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c| 2 +- drivers/staging/lustre/lustre/ptlrpc/service.c | 4 ++-- 16 files changed, 31 insertions(+), 24 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h b/drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h index d6e00f9..b75e401 100644 --- a/drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h +++ b/drivers/staging/lustre/include/linux/libcfs/linux/linux-lock.h @@ -66,7 +66,7 @@ * - spin_unlock(x) * - spin_unlock_bh(x) * - spin_trylock(x) - * - spin_is_locked(x) + * - assert_spin_locked(x) * * - spin_lock_irq(x) * - spin_lock_irqsave(x, f) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm.h b/drivers/staging/lustre/lustre/include/lustre_dlm.h index e28e31a..0c6b784 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm.h @@ -1445,7 +1445,7 @@ static inline void unlock_res(struct ldlm_resource *res) /** Check if resource is already locked, assert if not. */ static inline void check_res_locked(struct ldlm_resource *res) { - LASSERT(spin_is_locked(&res->lr_lock)); + assert_spin_locked(&res->lr_lock); } struct ldlm_resource * lock_res_and_lock(struct ldlm_lock *lock); diff --git a/drivers/staging/lustre/lustre/include/lustre_net.h b/drivers/staging/lustre/lustre/include/lustre_net.h index 7640e17..f6b7d10 100644 --- a/drivers/staging/lustre/lustre/include/lustre_net.h +++ b/drivers/staging/lustre/lustre/include/lustre_net.h @@ -719,7 +719,7 @@ struct ptlrpc_nrs_pol_ops { * \a nrq * \param[in,out] nrqThe request * -* \pre spin_is_locked(&svcpt->scp_req_lock) +* \pre assert_spin_locked(&svcpt->scp_req_lock) * * \see ptlrpc_nrs_req_stop_nolock() */ diff --git a/drivers/staging/lustre/lustre/lov/lov_merge.c b/drivers/staging/lustre/lustre/lov/lov_merge.c index 0a14cee..da959e9 100644 --- a/drivers/staging/lustre/lustre/lov/lov_merge.c +++ b/drivers/staging/lustre/lustre/lov/lov_merge.c @@ -58,7 +58,7 @@ int lov_merge_lvb_kms(struct lov_stripe_md *lsm, int i; int rc = 0; - LASSERT(spin_is_locked(&lsm->lsm_lock)); + assert_spin_locked(&lsm->lsm_lock); LASSERT(lsm->lsm_lock_owner == current_pid()); CDEBUG(D_INODE, "MDT ID "DOSTID" initial value: s="LPU64" m="LPU64 @@ -145,7 +145,7 @@ int lov_adjust_kms(struct obd_export *exp, struct lov_stripe_md *lsm, int stripe = 0; __u64 kms; - LASSERT(spin_is_locked(&lsm->lsm_lock)); + assert_spin_locked(&lsm->lsm_lock); LASSERT(lsm->lsm_lock_owner == current_pid()); if (shrink) { diff --git a/drivers/staging/lustre/lustre/obdclass/cl_lock.c b/drivers/staging/lustre/lustre/obdclass/cl_lock.c index f8040a8..df77c4f 100644 --- a/drivers/staging/lustre/lustre/obdclass/cl_lock.c +++ b/drivers/staging/lustre/lustre/obdclass/cl_lock.c @@ -478,7 +478,7 @@ static struct cl_lock *cl_lock_lookup(const struct lu_env *env, struct cl_object_header *head; head = cl_object_header(obj); - LINVRNT(spin_is_locked(&head->coh_lock_guard)); + assert_spin_locked(&head->coh_lock_guard); CS_LOCK_INC(obj, lookup); list_for_each_entry(lock, &head->coh_locks, cll_linkage) {
[PATCH 47/47] staging/lustre/llite: prevent buffer overflow in fiemap
From: Bobi Jam lov_fiemap() does not take consider its @vallen parameter, which is the max buffer size the caller can hold for the fiemap extents. This patch fixes this and limits the max mapped fiemap extent count to fit in the preallocted buffer. This patch also fixes a memory out of bound write issue when the fiemap call is only for detecting the number of existing extent. Signed-off-by: Bobi Jam Reviewed-on: http://review.whamcloud.com/9834 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4619 Reviewed-by: Fan Yong Reviewed-by: Patrick Farrell Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/file.c | 15 +-- drivers/staging/lustre/lustre/lov/lov_obd.c | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c index 79accc5..562e337 100644 --- a/drivers/staging/lustre/lustre/llite/file.c +++ b/drivers/staging/lustre/lustre/llite/file.c @@ -1721,12 +1721,12 @@ out: * Make the FIEMAP get_info call and returns the result. */ static int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap, - int num_bytes) + size_t num_bytes) { struct obd_export *exp = ll_i2dtexp(inode); struct lov_stripe_md *lsm = NULL; struct ll_fiemap_info_key fm_key = { .name = KEY_FIEMAP, }; - int vallen = num_bytes; + __u32 vallen = num_bytes; int rc; /* Checks for fiemap flags */ @@ -3080,15 +3080,18 @@ static int ll_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, fiemap->fm_extent_count = fieinfo->fi_extents_max; fiemap->fm_start = start; fiemap->fm_length = len; - memcpy(&fiemap->fm_extents[0], fieinfo->fi_extents_start, - sizeof(struct ll_fiemap_extent)); + if (extent_count > 0) + memcpy(&fiemap->fm_extents[0], fieinfo->fi_extents_start, + sizeof(struct ll_fiemap_extent)); rc = ll_do_fiemap(inode, fiemap, num_bytes); fieinfo->fi_flags = fiemap->fm_flags; fieinfo->fi_extents_mapped = fiemap->fm_mapped_extents; - memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0], - fiemap->fm_mapped_extents * sizeof(struct ll_fiemap_extent)); + if (extent_count > 0) + memcpy(fieinfo->fi_extents_start, &fiemap->fm_extents[0], + fiemap->fm_mapped_extents * + sizeof(struct ll_fiemap_extent)); OBD_FREE_LARGE(fiemap, num_bytes); return rc; diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index dbd971a..12e778c 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -2248,11 +2248,12 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key, if (fm_end_offset == -EINVAL) GOTO(out, rc = -EINVAL); + if (fiemap_count_to_size(fiemap->fm_extent_count) > *vallen) + fiemap->fm_extent_count = fiemap_size_to_count(*vallen); if (fiemap->fm_extent_count == 0) { get_num_extents = 1; count_local = 0; } - /* Check each stripe */ for (cur_stripe = start_stripe, i = 0; i < stripe_count; i++, cur_stripe = (cur_stripe + 1) % lsm->lsm_stripe_count) { -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 43/47] staging/lustre/osc: Update inode timestamp for lockless IO as well
From: Swapnil Pimpale Removed the checks for oi_lockless from osc_io_read_start() and osc_io_write_start(). This patch also removes the unnecessary call to cl_object_attr_get() in osc_io_write_start() before calling cl_object_attr_set() Signed-off-by: Swapnil Pimpale Reviewed-on: http://review.whamcloud.com/8797 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3868 Reviewed-by: John L. Hammond Reviewed-by: Andreas Dilger Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/osc/osc_io.c | 26 +- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c index 6744dc6..09e06eb 100644 --- a/drivers/staging/lustre/lustre/osc/osc_io.c +++ b/drivers/staging/lustre/lustre/osc/osc_io.c @@ -509,12 +509,11 @@ static void osc_io_setattr_end(const struct lu_env *env, static int osc_io_read_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct osc_io*oio = cl2osc_io(env, slice); struct cl_object *obj = slice->cis_obj; struct cl_attr *attr = &osc_env_info(env)->oti_attr; int rc = 0; - if (oio->oi_lockless == 0 && !slice->cis_io->ci_noatime) { + if (!slice->cis_io->ci_noatime) { cl_object_attr_lock(obj); attr->cat_atime = LTIME_S(CURRENT_TIME); rc = cl_object_attr_set(env, obj, attr, CAT_ATIME); @@ -526,24 +525,17 @@ static int osc_io_read_start(const struct lu_env *env, static int osc_io_write_start(const struct lu_env *env, const struct cl_io_slice *slice) { - struct osc_io*oio = cl2osc_io(env, slice); struct cl_object *obj = slice->cis_obj; struct cl_attr *attr = &osc_env_info(env)->oti_attr; - int result = 0; + int rc = 0; - if (oio->oi_lockless == 0) { - OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); - cl_object_attr_lock(obj); - result = cl_object_attr_get(env, obj, attr); - if (result == 0) { - attr->cat_mtime = attr->cat_ctime = - LTIME_S(CURRENT_TIME); - result = cl_object_attr_set(env, obj, attr, - CAT_MTIME | CAT_CTIME); - } - cl_object_attr_unlock(obj); - } - return result; + OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_DELAY_SETTIME, 1); + cl_object_attr_lock(obj); + attr->cat_mtime = attr->cat_ctime = LTIME_S(CURRENT_TIME); + rc = cl_object_attr_set(env, obj, attr, CAT_MTIME | CAT_CTIME); + cl_object_attr_unlock(obj); + + return rc; } static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj, -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/47] staging/lustre/lov: to not hold sub locks at initialization
From: Jinshan Xiong Otherwise, it will cause deadlock because it essentially holds some sub locks and then to request others in an arbitrary order. Signed-off-by: Jinshan Xiong Reviewed-on: http://review.whamcloud.com/9152 Reviewed-by: Lai Siyao Reviewed-by: Bobi Jam Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/lov/lov_lock.c | 36 +--- 1 file changed, 1 insertion(+), 35 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_lock.c b/drivers/staging/lustre/lustre/lov/lov_lock.c index 0bbe141..08ac374 100644 --- a/drivers/staging/lustre/lustre/lov/lov_lock.c +++ b/drivers/staging/lustre/lustre/lov/lov_lock.c @@ -346,41 +346,7 @@ static int lov_lock_sub_init(const struct lu_env *env, } } LASSERT(nr == lck->lls_nr); - /* -* Then, create sub-locks. Once at least one sub-lock was created, -* top-lock can be reached by other threads. -*/ - for (i = 0; i < lck->lls_nr; ++i) { - struct cl_lock *sublock; - struct lov_lock_link *link; - if (lck->lls_sub[i].sub_lock == NULL) { - sublock = lov_sublock_alloc(env, io, lck, i, &link); - if (IS_ERR(sublock)) { - result = PTR_ERR(sublock); - break; - } - cl_lock_get_trust(sublock); - cl_lock_mutex_get(env, sublock); - cl_lock_mutex_get(env, parent); - /* -* recheck under mutex that sub-lock wasn't created -* concurrently, and that top-lock is still alive. -*/ - if (lck->lls_sub[i].sub_lock == NULL && - parent->cll_state < CLS_FREEING) { - lov_sublock_adopt(env, lck, sublock, i, link); - cl_lock_mutex_put(env, parent); - } else { - OBD_SLAB_FREE_PTR(link, lov_lock_link_kmem); - cl_lock_mutex_put(env, parent); - cl_lock_unhold(env, sublock, - "lov-parent", parent); - } - cl_lock_mutex_put(env, sublock); - cl_lock_put(env, sublock); - } - } /* * Some sub-locks can be missing at this point. This is not a problem, * because enqueue will create them anyway. Main duty of this function @@ -533,7 +499,7 @@ static int lov_lock_enqueue_one(const struct lu_env *env, struct lov_lock *lck, static int lov_sublock_fill(const struct lu_env *env, struct cl_lock *parent, struct cl_io *io, struct lov_lock *lck, int idx) { - struct lov_lock_link *link; + struct lov_lock_link *link = NULL; struct cl_lock *sublock; intresult; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 29/47] staging/lustre/lnet: lnet: fix issues found by Klocwork Insight tool
From: Dmitry Eremin Null pointer 'cp' that comes from line 2544 may be dereferenced at line 2618. Pointer 'ni' checked for NULL at line 1569 may be passed to function and may be dereferenced there by passing argument 1 to function 'lnet_ni_notify_locked' at line 1621. Null pointer 'best_iface' that comes from line 802 may be dereferenced at line 832. Buffer overflow of string buffer due to non null terminated string. Pointer 'tsc' returned from call to function 'sfw_find_test_case' at line 571 may be NULL and will be dereferenced at line 572. Local variable 'hash' is never used. Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c| 4 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++--- drivers/staging/lustre/lnet/lnet/router.c | 3 ++- drivers/staging/lustre/lnet/selftest/conctl.c | 11 +++ drivers/staging/lustre/lnet/selftest/framework.c | 14 +++--- 6 files changed, 31 insertions(+), 15 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 6173e74..9bf6c94 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -2609,13 +2609,17 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) case IBLND_REJECT_MSG_QUEUE_SIZE: CERROR("%s rejected: incompatible message queue depth %d, %d\n", - libcfs_nid2str(peer->ibp_nid), cp->ibcp_queue_depth, + libcfs_nid2str(peer->ibp_nid), + cp != NULL ? cp->ibcp_queue_depth : + IBLND_MSG_QUEUE_SIZE(rej->ibr_version), IBLND_MSG_QUEUE_SIZE(conn->ibc_version)); break; case IBLND_REJECT_RDMA_FRAGS: CERROR("%s rejected: incompatible # of RDMA fragments %d, %d\n", - libcfs_nid2str(peer->ibp_nid), cp->ibcp_max_frags, + libcfs_nid2str(peer->ibp_nid), + cp != NULL ? cp->ibcp_max_frags : + IBLND_RDMA_FRAGS(rej->ibr_version), IBLND_RDMA_FRAGS(conn->ibc_version)); break; diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 21d36ee..516f623 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -829,14 +829,14 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) best_npeers = iface->ksni_npeers; } + LASSERT(best_iface != NULL); + best_iface->ksni_npeers++; ip = best_iface->ksni_ipaddr; peer->ksnp_passive_ips[i] = ip; peer->ksnp_n_passive_ips = i+1; } - LASSERT (best_iface != NULL); - /* mark the best matching peer IP used */ j = ksocknal_match_peerip(best_iface, peerips, n_peerips); peerips[j] = 0; diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 3f3c341..f5a9ae3 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -127,8 +127,7 @@ lnet_create_remote_nets_table(void) static void lnet_destroy_remote_nets_table(void) { - int i; - struct list_head*hash; + int i; if (the_lnet.ln_remote_nets_hash == NULL) return; @@ -137,7 +136,8 @@ lnet_destroy_remote_nets_table(void) LASSERT(list_empty(&the_lnet.ln_remote_nets_hash[i])); LIBCFS_FREE(the_lnet.ln_remote_nets_hash, - LNET_REMOTE_NETS_HASH_SIZE * sizeof(*hash)); + LNET_REMOTE_NETS_HASH_SIZE * + sizeof(the_lnet.ln_remote_nets_hash[0])); the_lnet.ln_remote_nets_hash = NULL; } diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 995f509..ba0278e 100644 --- a/drivers/staging/lus
Re: [PATCH 00/47] Lustre fixes and cleanups
Hello! On Apr 27, 2014, at 1:33 PM, Greg Kroah-Hartman wrote: > I've applied these, except for the 3 gss patches. Thanks. gss stuff was kind of totally separate, tso I thought it was not so bad idea to include them, but they are definitely not required. > Also, there is now a build warning in the tree thanks to these, please > send a follow-on patch to fix it before you get an email from the 0-day > bot about it. This one? I was under impression it was there before the pile of the patches as lustre/llite/symlink.c was last touched back in March and none of my patches touch it. I'll have a patch for it shortly. In file included from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_compat25.h:41:0, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lvfs.h:48, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lvfs.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_support.h:41, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_class.h:40, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:49, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:42: /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c: In function Б─≤ll_follow_linkБ─≥: /home/green/bk/linux/include/linux/namei.h:88:29: warning: Б─≤symnameБ─≥ may be used uninitialized in this function [-Wmaybe-uninitialized] nd->saved_names[nd->depth] = path; ^ /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:123:8: note: Б─≤symnameБ─≥ was declared here char *symname; ^ Bye, Oleg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/lustre/llite: Fix a compile warning.
Quiet the warning below in Lustre code. Actually the warning is invalid since we either always assign the symname in ll_readlink_internal or return an error there and then the following rc check would assign symlink variable explicitly. In file included from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_compat25.h:41:0, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lvfs.h:48, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lvfs.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_support.h:41, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/obd_class.h:40, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/linux/lustre_lite.h:49, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/../include/lustre_lite.h:45, from /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:42: /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c: In function ‘ll_follow_link’: /home/green/bk/linux/include/linux/namei.h:88:29: warning: ‘symname’ may be used uninitialized in this function [-Wmaybe-uninitialized] nd->saved_names[nd->depth] = path; ^ /home/green/bk/linux/drivers/staging/lustre/lustre/llite/symlink.c:123:8: note: ‘symname’ was declared here char *symname; ^ Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/llite/symlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/llite/symlink.c b/drivers/staging/lustre/lustre/llite/symlink.c index 80d48b5..129d302 100644 --- a/drivers/staging/lustre/lustre/llite/symlink.c +++ b/drivers/staging/lustre/lustre/llite/symlink.c @@ -120,7 +120,7 @@ static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd) struct inode *inode = dentry->d_inode; struct ptlrpc_request *request = NULL; int rc; - char *symname; + char *symname = NULL; CDEBUG(D_VFSTRACE, "VFS Op\n"); /* Limit the recursive symlink depth to 5 instead of default -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/5] staging/lustre/lnet: fix potential null pointer dereference
From: Dmitry Eremin Pointer 'tsc' returned from call to function 'sfw_find_test_case' at line 571 may be NULL and will be dereferenced at line 572. found by Klocwork Insight tool Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/selftest/framework.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/framework.c b/drivers/staging/lustre/lnet/selftest/framework.c index 050723a..c141f93 100644 --- a/drivers/staging/lustre/lnet/selftest/framework.c +++ b/drivers/staging/lustre/lnet/selftest/framework.c @@ -547,10 +547,16 @@ sfw_test_rpc_fini (srpc_client_rpc_t *rpc) static inline int sfw_test_buffers(sfw_test_instance_t *tsi) { - struct sfw_test_case*tsc = sfw_find_test_case(tsi->tsi_service); - struct srpc_service *svc = tsc->tsc_srv_service; + struct sfw_test_case*tsc; + struct srpc_service *svc; int nbuf; + LASSERT(tsi != NULL); + tsc = sfw_find_test_case(tsi->tsi_service); + LASSERT(tsc != NULL); + svc = tsc->tsc_srv_service; + LASSERT(svc != NULL); + nbuf = min(svc->sv_wi_total, tsi->tsi_loop) / svc->sv_ncpts; return max(SFW_TEST_WI_MIN, nbuf + SFW_TEST_WI_EXTRA); } @@ -595,8 +601,10 @@ sfw_load_test(struct sfw_test_instance *tsi) void sfw_unload_test(struct sfw_test_instance *tsi) { - struct sfw_test_case *tsc = sfw_find_test_case(tsi->tsi_service); + struct sfw_test_case *tsc; + LASSERT(tsi != NULL); + tsc = sfw_find_test_case(tsi->tsi_service); LASSERT(tsc != NULL); if (tsi->tsi_is_client) -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/5] Lustre Klocwork fixes
This is just splitting big lnet fixes patch from Klocwork static analysis tool into smaller bits. Dmitry Eremin (5): staging/lustre/lnet: fix potential null pointer dereference staging/lustre/lnet: remove unused variable staging/lustre/lnet: fix potential null pointer dereference staging/lustre/lnet: fix potential null pointer dereference staging/lustre/lnet: fix potential null pointer dereference drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++-- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c| 4 ++-- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++--- drivers/staging/lustre/lnet/lnet/router.c | 3 ++- drivers/staging/lustre/lnet/selftest/framework.c | 14 +++--- 5 files changed, 24 insertions(+), 11 deletions(-) -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/5] staging/lustre/lnet: remove unused variable
From: Dmitry Eremin Local variable 'hash' is never used found by Klocwork Insight tool Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/api-ni.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 85b8d81..3f1fdaa 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -127,8 +127,7 @@ lnet_create_remote_nets_table(void) static void lnet_destroy_remote_nets_table(void) { - int i; - struct list_head*hash; + int i; if (the_lnet.ln_remote_nets_hash == NULL) return; @@ -137,7 +136,8 @@ lnet_destroy_remote_nets_table(void) LASSERT(list_empty(&the_lnet.ln_remote_nets_hash[i])); LIBCFS_FREE(the_lnet.ln_remote_nets_hash, - LNET_REMOTE_NETS_HASH_SIZE * sizeof(*hash)); + LNET_REMOTE_NETS_HASH_SIZE * + sizeof(the_lnet.ln_remote_nets_hash[0])); the_lnet.ln_remote_nets_hash = NULL; } -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] staging/lustre/lnet: fix potential null pointer dereference
From: Dmitry Eremin Pointer 'ni' checked for NULL at line 1569 may be passed to function and may be dereferenced there by passing argument 1 to function 'lnet_ni_notify_locked' at line 1621. found by Klocwork Insight tool Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/router.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c index 995f509..ba0278e 100644 --- a/drivers/staging/lustre/lnet/lnet/router.c +++ b/drivers/staging/lustre/lnet/lnet/router.c @@ -1559,7 +1559,8 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, cfs_time_t when) lnet_notify_locked(lp, ni == NULL, alive, when); - lnet_ni_notify_locked(ni, lp); + if (ni != NULL) + lnet_ni_notify_locked(ni, lp); lnet_peer_decref_locked(lp); -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/5] staging/lustre/lnet: fix potential null pointer dereference
From: Dmitry Eremin Null pointer 'cp' that comes from line 2544 may be dereferenced at line 2618. found by Klocwork Insight tool Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c index 6173e74..9bf6c94 100644 --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c @@ -2609,13 +2609,17 @@ kiblnd_rejected (kib_conn_t *conn, int reason, void *priv, int priv_nob) case IBLND_REJECT_MSG_QUEUE_SIZE: CERROR("%s rejected: incompatible message queue depth %d, %d\n", - libcfs_nid2str(peer->ibp_nid), cp->ibcp_queue_depth, + libcfs_nid2str(peer->ibp_nid), + cp != NULL ? cp->ibcp_queue_depth : + IBLND_MSG_QUEUE_SIZE(rej->ibr_version), IBLND_MSG_QUEUE_SIZE(conn->ibc_version)); break; case IBLND_REJECT_RDMA_FRAGS: CERROR("%s rejected: incompatible # of RDMA fragments %d, %d\n", - libcfs_nid2str(peer->ibp_nid), cp->ibcp_max_frags, + libcfs_nid2str(peer->ibp_nid), + cp != NULL ? cp->ibcp_max_frags : + IBLND_RDMA_FRAGS(rej->ibr_version), IBLND_RDMA_FRAGS(conn->ibc_version)); break; -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] staging/lustre/lnet: fix potential null pointer dereference
From: Dmitry Eremin Null pointer 'best_iface' that comes from line 802 may be dereferenced at line 832. found by Klocwork Insight tool Signed-off-by: Dmitry Eremin Reviewed-on: http://review.whamcloud.com/9386 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c index 21d36ee..516f623 100644 --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c @@ -829,14 +829,14 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int n_peerips) best_npeers = iface->ksni_npeers; } + LASSERT(best_iface != NULL); + best_iface->ksni_npeers++; ip = best_iface->ksni_ipaddr; peer->ksnp_passive_ips[i] = ip; peer->ksnp_n_passive_ips = i+1; } - LASSERT (best_iface != NULL); - /* mark the best matching peer IP used */ j = ksocknal_match_peerip(best_iface, peerips, n_peerips); peerips[j] = 0; -- 1.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/5] staging/lustre/lnet: fix potential null pointer dereference
On Apr 27, 2014, at 6:05 PM, One Thousand Gnomes wrote: >> Reviewed-by: John L. Hammond >> Reviewed-by: Isaac Huang >> Signed-off-by: Oleg Drokin >> --- >> drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c >> b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c >> index 21d36ee..516f623 100644 >> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c >> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c >> @@ -829,14 +829,14 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 >> *peerips, int n_peerips) >> best_npeers = iface->ksni_npeers; >> } >> >> +LASSERT(best_iface != NULL); >> + > > And this solves the problem how ??? This does not really solve anything. Just moves the check to where it's actually going to do anything instead of the check being guarded by the NULL pointer access earlier on. Could have been removed instead of course to just get an oops at all times. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging/lustre/lnet: fix potential null pointer dereference
Hello! On Apr 27, 2014, at 6:39 PM, Greg Kroah-Hartman wrote: >> >> -lnet_ni_notify_locked(ni, lp); >> +if (ni != NULL) >> +lnet_ni_notify_locked(ni, lp); > > Why can't lnet_ni_notify_locked() accept NULL as an input? It makes no sense, because then there is nowhere to send the notification. That said, it appears a race is possible where one caller updated let_peer structure to ask for a notification and then we fell through here with a NULL ni and called into lnet_ni_notify_locked where we'd try to dereference this NULL ni. But this is the only called that accepts separate ni and lp, where as the only other caller gets them from the same struct where they are updated more in sync. I guess it makes sense to update lnet_ni_notify_locked as a future-proofing excercise. Thanks, I'll update this patch. Bye, Oleg ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/lustre: Replace jobid acquiring with per node setting
Insted of meddling directly in process environment variables (which is also not possible on certain platforms due to not exported symbols), create jobid_name proc file to represent this info (to be filled by job scheduler epilogue). Signed-off-by: Oleg Drokin CC: Andreas Dilger --- .../staging/lustre/include/linux/libcfs/curproc.h | 1 - .../staging/lustre/lustre/include/lprocfs_status.h | 1 + drivers/staging/lustre/lustre/include/obd_class.h | 3 + .../lustre/lustre/libcfs/linux/linux-curproc.c | 152 - drivers/staging/lustre/lustre/obdclass/class_obd.c | 50 ++- .../lustre/lustre/obdclass/linux/linux-module.c| 27 6 files changed, 44 insertions(+), 190 deletions(-) diff --git a/drivers/staging/lustre/include/linux/libcfs/curproc.h b/drivers/staging/lustre/include/linux/libcfs/curproc.h index 8fd47c9..b314f34 100644 --- a/drivers/staging/lustre/include/linux/libcfs/curproc.h +++ b/drivers/staging/lustre/include/linux/libcfs/curproc.h @@ -56,7 +56,6 @@ /* check if task is running in compat mode.*/ #define current_pid() (current->pid) #define current_comm() (current->comm) -int cfs_get_environ(const char *key, char *value, int *val_len); typedef __u32 cfs_cap_t; diff --git a/drivers/staging/lustre/lustre/include/lprocfs_status.h b/drivers/staging/lustre/lustre/include/lprocfs_status.h index 9ce12c7..1b7f6a9 100644 --- a/drivers/staging/lustre/lustre/include/lprocfs_status.h +++ b/drivers/staging/lustre/lustre/include/lprocfs_status.h @@ -369,6 +369,7 @@ static inline void s2dhms(struct dhms *ts, time_t secs) #define JOBSTATS_JOBID_VAR_MAX_LEN 20 #define JOBSTATS_DISABLE "disable" #define JOBSTATS_PROCNAME_UID "procname_uid" +#define JOBSTATS_NODELOCAL "nodelocal" extern int lprocfs_write_frac_helper(const char *buffer, unsigned long count, int *val, int mult); diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 61ba370..e265820 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h @@ -2182,6 +2182,9 @@ void class_exit_uuidlist(void); int mea_name2idx(struct lmv_stripe_md *mea, const char *name, int namelen); int raw_name2idx(int hashtype, int count, const char *name, int namelen); +/* class_obd.c */ +extern char obd_jobid_node[]; + /* prng.c */ #define ll_generate_random_uuid(uuid_out) cfs_get_random_bytes(uuid_out, sizeof(class_uuid_t)) diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c index e74c3e2..bd301ce 100644 --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-curproc.c @@ -100,158 +100,6 @@ cfs_cap_t cfs_curproc_cap_pack(void) return cap; } -static int cfs_access_process_vm(struct task_struct *tsk, unsigned long addr, -void *buf, int len, int write) -{ - /* Just copied from kernel for the kernels which doesn't -* have access_process_vm() exported */ - struct mm_struct *mm; - struct vm_area_struct *vma; - struct page *page; - void *old_buf = buf; - - mm = get_task_mm(tsk); - if (!mm) - return 0; - - down_read(&mm->mmap_sem); - /* ignore errors, just check how much was successfully transferred */ - while (len) { - int bytes, rc, offset; - void *maddr; - - rc = get_user_pages(tsk, mm, addr, 1, -write, 1, &page, &vma); - if (rc <= 0) - break; - - bytes = len; - offset = addr & (PAGE_SIZE-1); - if (bytes > PAGE_SIZE-offset) - bytes = PAGE_SIZE-offset; - - maddr = kmap(page); - if (write) { - copy_to_user_page(vma, page, addr, - maddr + offset, buf, bytes); - set_page_dirty_lock(page); - } else { - copy_from_user_page(vma, page, addr, - buf, maddr + offset, bytes); - } - kunmap(page); - page_cache_release(page); - len -= bytes; - buf += bytes; - addr += bytes; - } - up_read(&mm->mmap_sem); - mmput(mm); - - return buf - old_buf; -} - -/* Read the environment variable of current process specified by @key. */ -int cfs_get_environ(const char *key, char *value, int *val_len) -{ - struct mm_struct *mm; - char *buffer, *tmp_buf = NULL; - int buf_len = PAGE_CACHE_SIZE; -