[lustre-devel] [PATCH 09/24] lustre: mdc: check/grab import before access
James Simmons
jsimmons at infradead.org
Sat Sep 17 22:21:59 PDT 2022
From: Alex Zhuravlev <bzzz at whamcloud.com>
to ensure the import doesn't disappear while being accessed
via sysfs.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14441
Lustre-commit: b8416320b381ae8a6 ("LU-14441 mdc: check/grab import before access")
Signed-off-by: Alex Zhuravlev <bzzz at whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41681
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Reviewed-by: Neil Brown <neilb at suse.de>
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
fs/lustre/mdc/lproc_mdc.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/lustre/mdc/lproc_mdc.c b/fs/lustre/mdc/lproc_mdc.c
index 3de6533..cb3744a 100644
--- a/fs/lustre/mdc/lproc_mdc.c
+++ b/fs/lustre/mdc/lproc_mdc.c
@@ -340,6 +340,7 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
+ struct obd_import *imp;
unsigned int val;
int rc;
@@ -347,11 +348,10 @@ static ssize_t max_rpcs_in_flight_store(struct kobject *kobj,
if (rc)
return rc;
- rc = obd_set_max_rpcs_in_flight(&obd->u.cli, val);
- if (rc)
- count = rc;
+ with_imp_locked(obd, imp, rc)
+ rc = obd_set_max_rpcs_in_flight(&obd->u.cli, val);
- return count;
+ return rc ? rc : count;
}
LUSTRE_RW_ATTR(max_rpcs_in_flight);
@@ -372,6 +372,7 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj,
{
struct obd_device *obd = container_of(kobj, struct obd_device,
obd_kset.kobj);
+ struct obd_import *imp;
u16 val;
int rc;
@@ -379,11 +380,10 @@ static ssize_t max_mod_rpcs_in_flight_store(struct kobject *kobj,
if (rc)
return rc;
- rc = obd_set_max_mod_rpcs_in_flight(&obd->u.cli, val);
- if (rc)
- count = rc;
+ with_imp_locked(obd, imp, rc)
+ rc = obd_set_max_mod_rpcs_in_flight(&obd->u.cli, val);
- return count;
+ return rc ? rc : count;
}
LUSTRE_RW_ATTR(max_mod_rpcs_in_flight);
--
1.8.3.1
More information about the lustre-devel
mailing list