From df3e6b4404496530a2ee65722b4b739cc0278227 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Wed, 30 Mar 2022 02:28:04 -0400 Subject: [PATCH] LU-14975 utils: non-recursive dir migration fix 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 Change-Id: I8814aaae7c267cec51654175f9fa0708f7685a5a Reviewed-on: https://review.whamcloud.com/47012 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Hongchao Zhang Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 14 +++++++++----- lustre/utils/liblustreapi.c | 3 ++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index ad95b63..c7a0cfa 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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" diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 8ce5dc4..4d4b1f1 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -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) { /* -- 1.8.3.1