From 4794fcd61a25fe32f0c6f162049983961d01307a Mon Sep 17 00:00:00 2001 From: Feng Lei Date: Wed, 5 Mar 2025 10:51:09 +0800 Subject: [PATCH] LU-18758 tests: test lfs migrate --block on changing file Run 'lfs migrate --block' on a continously changing file to check wether '--block' option is broken. Test-Parameters: trivial env="ONLY=56xab,ONLY_REPEAT=500" Signed-off-by: Lei Feng Change-Id: I48492b6296f81d0cbe3bc83fad2ffeb855dff1aa Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58299 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Etienne AUJAMES Reviewed-by: Oleg Drokin --- lustre/tests/sanity.sh | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7c90f65..9e21ed2 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -8393,7 +8393,7 @@ test_56xB() { run_test 56xB "lfs migrate with -0, --null, --files-from arguments" test_56xa() { - [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs" + (( $OSTCOUNT >= 2 )) || skip_env "needs >= 2 OSTs" check_swap_layouts_support local dir=$DIR/$tdir/$testnum @@ -8417,6 +8417,30 @@ test_56xa() { } run_test 56xa "lfs migration --block support" +test_56xab() { + local pid + local dir=$DIR/$tdir/$testnum + local file1=$dir/$tfile + + (( $OSTCOUNT >= 2 )) || skip_env "needs >= 2 OSTs" + check_swap_layouts_support + + test_mkdir -p $dir + $LFS setstripe -c 2 $file1 + + dd if=/dev/urandom of=$file1 bs=1 oflag=sync & pid=$! + kill -0 $pid || + error "failed to start dd to write to $file1 continously" + stack_trap "kill $pid" + sleep 1 + + $LFS migrate --block -c 1 $file1 || error "migrate failed rc = $?" + + ls -l $file1 + $LFS getstripe $file1 +} +run_test 56xab "lfs migration --block on changing file" + check_migrate_links() { [[ "$1" == "--rsync" ]] && local opts="--rsync -y" && shift local dir="$1" -- 1.8.3.1