Whamcloud - gitweb
LU-18758 tests: test lfs migrate --block on changing file 99/58299/5
authorFeng Lei <flei@whamcloud.com>
Wed, 5 Mar 2025 02:51:09 +0000 (10:51 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 26 Mar 2025 04:02:01 +0000 (04:02 +0000)
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 <flei@whamcloud.com>
Change-Id: I48492b6296f81d0cbe3bc83fad2ffeb855dff1aa
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58299
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Etienne AUJAMES <eaujames@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/sanity.sh

index 7c90f65..9e21ed2 100755 (executable)
@@ -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"