Whamcloud - gitweb
LU-12960 lod: don't set index for 2nd stripe if specific 35/36735/4
authorLai Siyao <lai.siyao@whamcloud.com>
Sat, 7 Sep 2019 09:38:46 +0000 (17:38 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 3 Dec 2020 07:26:34 +0000 (07:26 +0000)
When MDTs are specific, don't set index for the second stripe
allocation, otherwise it's not created on specific MDT.

Add sanity 31q.

Fixes: c1d0a355a6 ("LU-12624 lod: alloc dir stripes by QoS")
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: I415be0fa7c6e702ec72dcaac88bba55290463d44
Reviewed-on: https://review.whamcloud.com/36735
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lod/lod_object.c
lustre/tests/sanity.sh

index 0c2c7e7..fc9efb5 100644 (file)
@@ -2075,7 +2075,7 @@ static int lod_mdt_alloc_specific(const struct lu_env *env,
        int rc;
 
        master_index = lu_site2seq(lod2lu_dev(lod)->ld_site)->ss_node_id;
-       if (stripe_count > 1)
+       if (!is_specific && stripe_count > 1)
                /* Set the start index for the 2nd stripe allocation */
                mdt_indices[1] = (mdt_indices[0] + 1) %
                                        (lod->lod_remote_mdt_count + 1);
index e01bdc8..b720668 100755 (executable)
@@ -3347,6 +3347,21 @@ test_31p() {
 }
 run_test 31p "remove of open striped directory"
 
+test_31q() {
+       [ $MDSCOUNT -lt 3 ] && skip_env "needs >= 3 MDTs"
+
+       $LFS mkdir -i 3,1 $DIR/$tdir || error "mkdir failed"
+       index=$($LFS getdirstripe -i $DIR/$tdir)
+       [ $index -eq 3 ] || error "first stripe index $index != 3"
+       index=$($LFS getdirstripe $DIR/$tdir | tail -1 | awk '{print $1}')
+       [ $index -eq 1 ] || error "second stripe index $index != 1"
+
+       # when "-c <stripe_count>" is set, the number of MDTs specified after
+       # "-i" should equal to the stripe count
+       $LFS mkdir -i 3,1 -c 3 $DIR/$tdir.2 && error "mkdir should fail" || true
+}
+run_test 31q "create striped directory on specific MDTs"
+
 cleanup_test32_mount() {
        local rc=0
        trap 0