From: Emoly Liu Date: Wed, 13 Mar 2013 15:51:37 +0000 (+0800) Subject: LU-2871 lod: stripe data across the OSTs correctly X-Git-Tag: 2.3.63~60 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=20baff1f7f77b02f629e5f7980807ad151423b3b;ds=inline LU-2871 lod: stripe data across the OSTs correctly Since the ost-in-use array is initialized with 0 and isn't set with OST index number correctly, OST0 is always skipped when allocating objects on OSTs with specific stripe offset (offset > 0). For example, when running command "lfs setstripe -c -1 -i 2 testfile" on 4 OSTs, we will get a wrong layout, like obdidx objid objid group 2 3 0x3 0 3 3 0x3 0 1 4 0x4 0 2 4 0x4 0 To fix the problem, we initialize the array with -1 instead, and store the correct OST index number in it. Signed-off-by: Liu Ying Change-Id: I5eeced6b66ae40771f8896204c5a6ed8e6663e57 Reviewed-on: http://review.whamcloud.com/5554 Tested-by: Hudson Reviewed-by: Bobi Jam Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev --- diff --git a/lustre/lod/lod_qos.c b/lustre/lod/lod_qos.c index 29c582a..a009f8b 100644 --- a/lustre/lod/lod_qos.c +++ b/lustre/lod/lod_qos.c @@ -632,7 +632,7 @@ static inline int lod_qos_ost_in_use_clear(const struct lu_env *env, int stripes CERROR("can't allocate memory for ost-in-use array\n"); return -ENOMEM; } - memset(info->lti_ea_store, 0, sizeof(int) * stripes); + memset(info->lti_ea_store, -1, sizeof(int) * stripes); return 0; } @@ -921,6 +921,7 @@ repeat_find: /* * We've successfuly declared (reserved) an object */ + lod_qos_ost_in_use(env, stripe_num, ost_idx); stripe[stripe_num] = o; stripe_num++; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index c190c7c..fb22df9 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -1805,6 +1805,32 @@ test_27B() { # LU-2523 } run_test 27B "call setstripe on open unlinked file/rename victim" +test_27C() { #LU-2871 + [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return + + declare -a ost_idx + local index + local i + local j + + test_mkdir -p $DIR/$tdir + cd $DIR/$tdir + for i in $(seq 0 $((OSTCOUNT - 1))); do + # set stripe across all OSTs starting from OST$i + $SETSTRIPE -i $i -c -1 $tfile$i + # get striping information + ost_idx=($($GETSTRIPE $tfile$i | + tail -n $((OSTCOUNT + 1)) | awk '{print $1}')) + echo ${ost_idx[@]} + # check the layout + for j in $(seq 0 $((OSTCOUNT - 1))); do + index=$(((i + j) % OSTCOUNT)) + [ ${ost_idx[$j]} -eq $index ] || error + done + done +} +run_test 27C "check full striping across all OSTs" + # createtest also checks that device nodes are created and # then visible correctly (#2091) test_28() { # bug 2091