From: Artem Blagodarenko Date: Fri, 21 Aug 2020 17:43:38 +0000 (-0400) Subject: LU-13942 obd: check if sbi->ll_md_exp is initialized X-Git-Tag: 2.14.52~35 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=1de8c3739d6bac76b63a0e59a8aadf4ce491f88a;p=fs%2Flustre-release.git LU-13942 obd: check if sbi->ll_md_exp is initialized 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(). Change-Id: Ife72a62ba42573e2a9c6d244e36cde738b70c15a hpe-bug-id: LUS-9150 Signed-off-by: Artem Blagodarenko Reviewed-on: https://es-gerrit.dev.cray.com/157732 Reviewed-by: Alexander Zarochentsev Tested-by: Alexander Lezhoev Reviewed-by: Andriy Skulysh Reviewed-on: https://review.whamcloud.com/39812 Reviewed-by: James Simmons Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 1dc5f12..6be7628 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1046,13 +1046,14 @@ 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; ENTRY; - if (unlikely(obd == NULL)) + if (unlikely(exp == NULL || exp->exp_obd == NULL)) RETURN(-EINVAL); + obd = exp->exp_obd; OBD_CHECK_DEV_ACTIVE(obd); if (unlikely(!obd->obd_type || !obd->obd_type->typ_dt_ops->o_statfs)) {