From 6e8a449454b896ee514183e6ea55ec1099ff909a Mon Sep 17 00:00:00 2001 From: Swapnil Pimpale Date: Mon, 12 Aug 2013 16:41:00 +0530 Subject: [PATCH] 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 --- lustre/tests/sanity.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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 # -- 1.8.3.1