Whamcloud - gitweb
LU-7059 mdt: reset rc=0 in mdt_lock_objects_in_linkea 31/16131/2
authorwang di <di.wang@intel.com>
Thu, 27 Aug 2015 17:28:19 +0000 (10:28 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 4 Sep 2015 05:01:37 +0000 (05:01 +0000)
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 <di.wang@intel.com>
Change-Id: I063a6e461e2fe427105e8063720f59df42a8eda3
Reviewed-on: http://review.whamcloud.com/16131
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mdt/mdt_reint.c
lustre/tests/sanity.sh

index f2514c7..652dba4 100644 (file)
@@ -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);
index fdb74d4..b3ca363 100644 (file)
@@ -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