[lustre-devel] [PATCH 05/24] lustre: mgc: do not ignore target registration failure

James Simmons jsimmons at infradead.org
Thu Jan 13 17:37:44 PST 2022


From: Alexander Zarochentsev <alexander.zarochentsev at hpe.com>

A serious target registation failure with LDD_F_ERROR
flag set is ignored by target, it makes possible
registreting new target with already used index;
Writeconf flag should be encoded in fs label regardless
the "first_time" flag, otherwise target cannot be registered
after initial registration failure.

HPE-bug-id: LUS-8752
WC-bug-id: https://jira.whamcloud.com/browse/LU-15112
Lustre-commit: cefabee52586f443b ("LU-15112 mgc: do not ignore target registration failure")
Signed-off-by: Alexander Zarochentsev <alexander.zarochentsev at hpe.com>
Reviewed-on: https://review.whamcloud.com/45259
Reviewed-by: Alexander Boyko <alexander.boyko at hpe.com>
Reviewed-by: Alexey Lyashkov <alexey.lyashkov at hpe.com>
Reviewed-by: Oleg Drokin <green at whamcloud.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 fs/lustre/mgc/mgc_request.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/lustre/mgc/mgc_request.c b/fs/lustre/mgc/mgc_request.c
index 3955d1f..62bf0ea 100644
--- a/fs/lustre/mgc/mgc_request.c
+++ b/fs/lustre/mgc/mgc_request.c
@@ -937,7 +937,10 @@ static int mgc_target_register(struct obd_export *exp,
 	if (!rc) {
 		rep_mti = req_capsule_server_get(&req->rq_pill,
 						 &RMF_MGS_TARGET_INFO);
-		memcpy(mti, rep_mti, sizeof(*rep_mti));
+		if (rep_mti)
+			memcpy(mti, rep_mti, sizeof(*rep_mti));
+	}
+	if (!rc) {
 		CDEBUG(D_MGC, "register %s got index = %d\n",
 		       mti->mti_svname, mti->mti_stripe_index);
 	}
-- 
1.8.3.1



More information about the lustre-devel mailing list