Whamcloud - gitweb
LU-14928 mgs: allow md target re-register 94/44594/5
authorAlexander Zarochentsev <alexander.zarochentsev@hpe.com>
Sun, 30 May 2021 13:43:05 +0000 (16:43 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 25 Aug 2021 06:23:43 +0000 (06:23 +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.

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

index fe5c729..23890f8 100644 (file)
@@ -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;
index 48d84a8..8f9e321 100644 (file)
@@ -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