From 0ab2b5f93442f6c4844fadcbca981646624f6474 Mon Sep 17 00:00:00 2001 From: wang di Date: Thu, 27 Aug 2015 10:28:19 -0700 Subject: [PATCH] LU-7059 mdt: reset rc=0 in mdt_lock_objects_in_linkea reset rc to 0 in mdt_lock_objects_in_linkea, otherwise it might cause migration failure for mulitple link file. Add sanity.sh 230e to verify the case. Signed-off-by: wang di Change-Id: I063a6e461e2fe427105e8063720f59df42a8eda3 Reviewed-on: http://review.whamcloud.com/16131 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: James Simmons Reviewed-by: Andreas Dilger --- lustre/mdt/mdt_reint.c | 2 +- lustre/tests/sanity.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index f2514c7..652dba4 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -1324,7 +1324,7 @@ static int mdt_lock_objects_in_linkea(struct mdt_thread_info *info, OBD_FREE_PTR(mll); GOTO(out, rc = -EBUSY); } - + rc = 0; INIT_LIST_HEAD(&mll->mll_list); mll->mll_obj = mdt_pobj; list_add_tail(&mll->mll_list, lock_list); diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fdb74d4..b3ca363 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -12815,6 +12815,50 @@ test_230d() { } run_test 230d "check migrate big directory" +test_230e() { + [ $PARALLEL == "yes" ] && skip "skip parallel run" && return + [ $MDSCOUNT -lt 2 ] && skip "needs >= 2 MDTs" && return + local i + local j + local a_fid + local b_fid + + mkdir -p $DIR/$tdir + mkdir $DIR/$tdir/migrate_dir + mkdir $DIR/$tdir/other_dir + touch $DIR/$tdir/migrate_dir/a + ln $DIR/$tdir/migrate_dir/a $DIR/$tdir/other_dir/b + + $LFS migrate -m 1 $DIR/$tdir/migrate_dir || + error "migrate dir fails" + + mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir) + [ $mdt_index == 1 ] || error "migrate_dir is not on MDT1" + + mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a) + [ $mdt_index == 0 ] || error "a is not on MDT0" + + $LFS migrate -m 1 $DIR/$tdir/other_dir || + error "migrate dir fails" + + mdt_index=$($LFS getstripe -M $DIR/$tdir/other_dir) + [ $mdt_index == 1 ] || error "other_dir is not on MDT1" + + mdt_index=$($LFS getstripe -M $DIR/$tdir/migrate_dir/a) + [ $mdt_index == 1 ] || error "a is not on MDT1" + + mdt_index=$($LFS getstripe -M $DIR/$tdir/other_dir/b) + [ $mdt_index == 1 ] || error "b is not on MDT1" + + a_fid=$($LFS path2fid $DIR/$tdir/migrate_dir/a) + b_fid=$($LFS path2fid $DIR/$tdir/other_dir/b) + + [ "$a_fid" = "$b_fid" ] || error "different fid after migration" + + rm -rf $DIR/$tdir || error "rm dir failed after migration" +} +run_test 230e "migrate mulitple link files" + test_231a() { # For simplicity this test assumes that max_pages_per_rpc -- 1.8.3.1