Whamcloud - gitweb
LU-14975 utils: non-recursive dir migration fix 12/47012/2
authorLai Siyao <lai.siyao@whamcloud.com>
Wed, 30 Mar 2022 06:28:04 +0000 (02:28 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Aug 2022 19:53:30 +0000 (19:53 +0000)
If sem_init() doesn't return 0, llapi_semantic_traverse() won't
call sem_fini() in directory traverse, therefore
cb_migrate_mdt_init() shouldn't increase param->fp_depth if it
reaches max depth in non-recursive mode.

Update sanity 230w.

Fixes: 5604a6d270b ("LU-14975 dne: dir migration in non-recursive mode")
Signed-off-by: Lai Syao <lai.siyao@whamcloud.com>
Change-Id: I8814aaae7c267cec51654175f9fa0708f7685a5a
Reviewed-on: https://review.whamcloud.com/47012
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Hongchao Zhang <hongchao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh
lustre/utils/liblustreapi.c

index ad95b63..c7a0cfa 100755 (executable)
@@ -20719,10 +20719,12 @@ run_test 230v "subdir migrated to the MDT where its parent is located"
 
 test_230w() {
        (( MDSCOUNT > 1 )) || skip "needs >= 2 MDTs"
-       (( MDS1_VERSION >= $(version_code 2.14.53) )) ||
-               skip "Need MDS version at least 2.14.53"
+       (( MDS1_VERSION >= $(version_code 2.15.0) )) ||
+               skip "Need MDS version at least 2.15.0"
 
-       mkdir -p $DIR/$tdir/sub || error "mkdir failed"
+       mkdir -p $DIR/$tdir || error "mkdir $tdir failed"
+       createmany -o $DIR/$tdir/f 10 || error "create files failed"
+       createmany -d $DIR/$tdir/d 10 || error "create dirs failed"
 
        $LFS migrate -m 1 -c $MDSCOUNT -d $DIR/$tdir ||
                error "migrate failed"
@@ -20730,8 +20732,10 @@ test_230w() {
        (( $($LFS getdirstripe -c $DIR/$tdir) == MDSCOUNT )) ||
                error "$tdir stripe count mismatch"
 
-       (( $($LFS getdirstripe -c $DIR/$tdir/sub) == 0 )) ||
-               error "$tdir/sub is striped"
+       for i in $(seq 0 9); do
+               (( $($LFS getdirstripe -c $DIR/$tdir/d$i) == 0 )) ||
+                       error "d$i is striped"
+       done
 }
 run_test 230w "non-recursive mode dir migration"
 
index 8ce5dc4..4d4b1f1 100644 (file)
@@ -6016,7 +6016,8 @@ out:
        /* Do not get down anymore? */
        if (param->fp_depth == param->fp_max_depth)
                ret = 1;
-       param->fp_depth++;
+       else
+               param->fp_depth++;
 
        if (dp != NULL) {
                /*