From: Swapnil Pimpale Date: Mon, 12 Aug 2013 11:11:00 +0000 (+0530) Subject: LU-2935 tests: Test for layout swap on open unlinked file X-Git-Tag: 2.4.93~53 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F7301%2F5;p=fs%2Flustre-release.git LU-2935 tests: Test for layout swap on open unlinked file This regression test verifies that layout swap works correctly on an open unlinked file Signed-off-by: Swapnil Pimpale Change-Id: Ib0de7de21286c3c9b37625008432ffd080de589b Reviewed-on: http://review.whamcloud.com/7301 Reviewed-by: John L. Hammond Tested-by: Hudson Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: jacques-Charles Lafoucriere Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 311beef..c740e59 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -11634,6 +11634,32 @@ test_235() { } run_test 235 "LU-1715: flock deadlock detection does not work properly" +#LU-2935 +test_236() { + check_swap_layouts_support && return 0 + test_mkdir -p $DIR/$tdir || error "mkdir $tdir failed" + + local ref1=/etc/passwd + local ref2=/etc/group + local file1=$DIR/$tdir/f1 + local file2=$DIR/$tdir/f2 + + $SETSTRIPE -c 1 $file1 || error "cannot setstripe on '$file1': rc = $?" + cp $ref1 $file1 || error "cp $ref1 $file1 failed: rc = $?" + $SETSTRIPE -c 2 $file2 || error "cannot setstripe on '$file2': rc = $?" + cp $ref2 $file2 || error "cp $ref2 $file2 failed: rc = $?" + exec {FD}<>$file2 + rm $file2 + $LFS swap_layouts $file1 /proc/self/fd/${FD} || + error "cannot swap layouts of '$file1' and /proc/self/fd/${FD}" + exec {FD}>&- + cmp $ref2 $file1 || error "content compare failed ($ref2 != $file1)" + + #cleanup + rm -rf $DIR/$tdir +} +run_test 236 "Layout swap on open unlinked file" + # # tests that do cleanup/setup should be run at the end #