Whamcloud - gitweb
LU-3817 llite: Truncate to restore file
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 311beef..b4918ed 100644 (file)
@@ -6338,7 +6338,15 @@ test_102l() {
 
        return 0;
 }
-run_test 102l "listxattr filter test =================================="
+run_test 102l "listxattr size test =================================="
+
+test_102m() { # LU-3403 llite: error of listxattr when buffer is small
+       local path=$DIR/$tfile
+       touch $path
+
+       listxattr_size_check $path || error "listattr_size_check $path failed"
+}
+run_test 102m "Ensure listxattr fails on small bufffer ========"
 
 cleanup_test102
 
@@ -11434,26 +11442,13 @@ test_229() { # LU-2482, LU-3448
        [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)"
        stat $DIR/$tfile || error "failed to stat released file"
 
-       $TRUNCATE $DIR/$tfile 200000 &&
-               error "truncate of released file should fail"
-
-       # Ensure that nothing happened anyway.
-       $CHECKSTAT -s 0 $DIR/$tfile ||
-               error "released file size should not change"
-
-       # Stripe count should be no change after truncate
-       stripe_count=$($GETSTRIPE -c $DIR/$tfile) || error "getstripe failed"
-       [ $stripe_count -eq 2 ] || error "after trunc: ($stripe_count)"
-
        chown $RUNAS_ID $DIR/$tfile ||
                error "chown $RUNAS_ID $DIR/$tfile failed"
 
        chgrp $RUNAS_ID $DIR/$tfile ||
                error "chgrp $RUNAS_ID $DIR/$tfile failed"
 
-       touch $DIR/$tfile ||
-               error "touch $DIR/$tfile failed"
-
+       touch $DIR/$tfile || error "touch $DIR/$tfile failed"
        rm $DIR/$tfile || error "failed to remove released file"
 }
 run_test 229 "getstripe/stat/rm/attr changes work on released files"
@@ -11634,6 +11629,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
 #