Whamcloud - gitweb
LU-3448 llite: call simple_setattr() from ll_md_setattr()
[fs/lustre-release.git] / lustre / tests / sanity.sh
index 3f8badb..d64d161 100644 (file)
@@ -2111,6 +2111,29 @@ test_31n() {
 }
 run_test 31n "check link count of unlinked file"
 
+link_one() {
+       local TEMPNAME=$(mktemp $1_XXXXXX)
+       mlink $TEMPNAME $1 2> /dev/null &&
+               echo "$BASHPID: link $TEMPNAME to $1 succeeded"
+       munlink $TEMPNAME
+}
+
+test_31o() { # LU-2901
+       mkdir -p $DIR/$tdir
+       for LOOP in $(seq 100); do
+               rm -f $DIR/$tdir/$tfile*
+               for THREAD in $(seq 8); do
+                       link_one $DIR/$tdir/$tfile.$LOOP &
+               done
+               wait
+               local LINKS=$(ls -1 $DIR/$tdir | grep -c $tfile.$LOOP)
+               [ $LINKS -gt 1 ] && ls $DIR/$tdir &&
+                       error "$LINKS duplicate links to $tfile.$LOOP" &&
+                       break || true
+       done
+}
+run_test 31o "duplicate hard links with same filename"
+
 cleanup_test32_mount() {
        trap 0
        $UMOUNT $DIR/$tdir/ext2-mountpoint
@@ -11107,12 +11130,15 @@ test_228c() {
 }
 run_test 228c "NOT shrink the last entry in OI index node to recycle idle leaf"
 
-test_229() { # LU-2482
+test_229() { # LU-2482, LU-3448
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return
+       [ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs" && return
 
-       # Create a file with a release layout (stripe count = 0)
+       rm -f $DIR/$tfile
+
+       # Create a file with a released layout and stripe count 2.
        $MULTIOP $DIR/$tfile H2c ||
-               error "failed to create file w. released layout"
+               error "failed to create file with released layout"
 
        $GETSTRIPE -v $DIR/$tfile
 
@@ -11124,8 +11150,13 @@ test_229() { # LU-2482
        [ $stripe_count -eq 2 ] || error "stripe count not 2 ($stripe_count)"
        stat $DIR/$tfile || error "failed to stat released file"
 
-       $TRUNCATE $DIR/$tfile 200000
-       $CHECKSTAT -s 200000 $DIR/$tfile || error
+       # Truncate should fail.
+       $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"
@@ -11133,7 +11164,7 @@ test_229() { # LU-2482
 
        rm $DIR/$tfile || error "failed to remove released file"
 }
-run_test 229 "getstripe/stat/rm work on released files (stripe count = 0)"
+run_test 229 "getstripe/stat/rm work on released files (stripe count = 2)"
 
 test_230a() {
        [ $PARALLEL == "yes" ] && skip "skip parallel run" && return