}
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
}
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
[ $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"
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