From: wang di Date: Thu, 12 Mar 2015 14:13:42 +0000 (-0700) Subject: LU-6373 llite: default dir stripe index only for mkdir X-Git-Tag: 2.7.52~35 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=7bba9569f40f2f81913cd6a0ff1b9b8523b686c4 LU-6373 llite: default dir stripe index only for mkdir Default dir stripe index should only work during mkdir, otherwise it will cause other open/create request being sent to the wrong MDT. Signed-off-by: wang di Change-Id: Id95d7218196d52950eceea38be5612ffe4a6b080 Reviewed-on: http://review.whamcloud.com/14096 Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index ea3620d..668a719 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2505,8 +2505,9 @@ struct md_op_data * ll_prep_md_op_data(struct md_op_data *op_data, op_data->op_default_stripe_offset = -1; if (S_ISDIR(i1->i_mode)) { op_data->op_mea1 = ll_i2info(i1)->lli_lsm_md; - op_data->op_default_stripe_offset = - ll_i2info(i1)->lli_def_stripe_offset; + if (opc == LUSTRE_OPC_MKDIR) + op_data->op_default_stripe_offset = + ll_i2info(i1)->lli_def_stripe_offset; } if (i2) { diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index d76aa06..a458bf5 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -13179,6 +13179,9 @@ test_300_check_default_striped_dir() mkdir $DIR/$tdir/$dirname/{test1,test2,test3,test4} || error "create dirs failed" + + createmany -o $DIR/$tdir/$dirname/f- 10 || error "create files failed" + unlinkmany $DIR/$tdir/$dirname/f- 10 || error "unlink files failed" for dir in $(find $DIR/$tdir/$dirname/*); do stripe_count=$($LFS getdirstripe -c $dir) [ $stripe_count -eq $default_count ] ||