[lustre-devel] [PATCH 12/27] lustre: obd: check if sbi->ll_md_exp is initialized

James Simmons jsimmons at infradead.org
Sun Jun 13 16:11:22 PDT 2021


From: Artem Blagodarenko <artem.blagodarenko at hpe.com>

Null reference at the start of obd_statfs() function is possible
because of ll_fill_super vs lctl race.

ll_md_exp is initialized in ll_fill_super()->
client_common_fill_super(), but if mount process stucks
in lustre_process_log() it doesn't reach client_common_fill_super().

HPE-bug-id: LUS-9150
WC-bug-id: https://jira.whamcloud.com/browse/LU-13942
Lustre-commit: 1de8c3739d6bac76b ("LU-13942 obd: check if sbi->ll_md_exp is initialized")
Signed-off-by: Artem Blagodarenko <artem.blagodarenko at hpe.com>
Reviewed-on: https://es-gerrit.dev.cray.com/157732
Reviewed-by: Alexander Zarochentsev <c17826 at cray.com>
Tested-by: Alexander Lezhoev <c17454 at cray.com>
Reviewed-by: Andriy Skulysh <c17819 at cray.com>
Reviewed-on: https://review.whamcloud.com/39812
Reviewed-by: James Simmons <jsimmons at infradead.org>
Reviewed-by: Andreas Dilger <adilger at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/include/obd_class.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/fs/lustre/include/obd_class.h b/fs/lustre/include/obd_class.h
index 5cbed01..4cc5a7df 100644
--- a/fs/lustre/include/obd_class.h
+++ b/fs/lustre/include/obd_class.h
@@ -921,12 +921,13 @@ static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp,
 			     struct obd_statfs *osfs, time64_t max_age,
 			     u32 flags)
 {
-	struct obd_device *obd = exp->exp_obd;
+	struct obd_device *obd;
 	int rc = 0;
 
-	if (unlikely(!obd))
+	if (unlikely(!exp) || !exp->exp_obd)
 		return -EINVAL;
 
+	obd = exp->exp_obd;
 	rc = obd_check_dev_active(obd);
 	if (rc)
 		return rc;
-- 
1.8.3.1



More information about the lustre-devel mailing list