Whamcloud - gitweb
LU-14928 mgs: allow md target re-register
authorAlexander Zarochentsev <alexander.zarochentsev@hpe.com>
Sun, 30 May 2021 13:43:05 +0000 (16:43 +0300)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 7 Dec 2023 11:11:51 +0000 (11:11 +0000)
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.

Lustre-change: https://review.whamcloud.com/44594
Lustre-commit: e4f3f47f04c762770bc36c1e3fa7e92e94a36704

HPE-bug-id: LUS-10098
Signed-off-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Change-Id: I698ee6d70ac96f54eaec57b5c5fe553d130ba011
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/53328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/mgs/mgs_llog.c
lustre/tests/conf-sanity.sh

index 0aece4b..f129f55 100644 (file)
@@ -2225,7 +2225,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;
index 13b69ec..3f8329c 100644 (file)
@@ -9788,6 +9788,18 @@ test_151() {
 }
 run_test 151 "damaged local config doesn't prevent mounting"
 
+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