From e4f3f47f04c762770bc36c1e3fa7e92e94a36704 Mon Sep 17 00:00:00 2001 From: Alexander Zarochentsev Date: Sun, 30 May 2021 16:43:05 +0300 Subject: [PATCH] LU-14928 mgs: allow md target re-register In a DNE system, it is not safe to do writeconf of a MD target and attempt to mount (and re-register) it again, as it creates a weird MDT-MDT osp devices like fsname-MDT0001-osp-MDT0001" and makes the system non-functioning. The fix doesn't allow creation of illegal devices. HPE-bug-id: LUS-10098 Signed-off-by: Alexander Zarochentsev Change-Id: I698ee6d70ac96f54eaec57b5c5fe553d130ba011 Reviewed-on: https://review.whamcloud.com/44594 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alexander Boyko Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin --- lustre/mgs/mgs_llog.c | 7 ++++++- lustre/tests/conf-sanity.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index fe5c729..23890f8 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -2241,7 +2241,12 @@ static int mgs_steal_client_llog_handler(const struct lu_env *env, if (sscanf(lustre_cfg_buf(lcfg, 2), "%d", &index) != 1) RETURN (-EINVAL); - + if (index == mti->mti_stripe_index) { + CDEBUG(D_INFO, + "attempt to create MDT%04x->MDT%04x osp device\n", + index, index); + RETURN(0); + } memcpy(tmti->mti_fsname, mti->mti_fsname, strlen(mti->mti_fsname)); tmti->mti_stripe_index = index; diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 48d84a8..8f9e321 100644 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -9248,6 +9248,18 @@ test_128() } run_test 128 "Force using remote logs with --nolocallogs" +test_130() +{ + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" + setupall + stop_mdt 2 || error "mdt2 stop failed" + do_facet mds2 "$TUNEFS --writeconf $(mdsdevname 2)" + start_mdt 2 || error "mdt2 start failed" + do_facet mds2 "$LCTL dl" | grep MDT0001-osp-MDT0001 && + error "Illegal OSP device created" || true +} +run_test 130 "re-register an MDT after writeconf" + if ! combined_mgs_mds ; then stop mgs fi -- 1.8.3.1