From: Lai Siyao Date: Sat, 7 Sep 2019 09:38:46 +0000 (+0800) Subject: LU-12960 lod: don't set index for 2nd stripe if specific X-Git-Tag: 2.13.57~30 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e7d91d9b8cf291d638857b6bd904469b46d1273a;hp=12333c1fecc00ed67597f189715a68cbfea7b287 LU-12960 lod: don't set index for 2nd stripe if specific 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 Change-Id: I415be0fa7c6e702ec72dcaac88bba55290463d44 Reviewed-on: https://review.whamcloud.com/36735 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 0c2c7e7..fc9efb5 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -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); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index e01bdc8..b720668 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 " 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