generic/{279, 28[1-3]}: hide SIGBUS reporting from golden output
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 4 Jul 2018 04:50:53 +0000 (21:50 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sat, 14 Jul 2018 10:02:50 +0000 (18:02 +0800)
These four tests check that mmap'd cow writes fail when the
filesystem goes down.  For regular filesystems the msync reports
EIO, but if quotas are enabled on xfs the write itself terminates
xfs_io with a SIGBUS.  We don't care how the write fails, so don't
let the SIGBUS report escape to the golden output.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/279
tests/generic/281
tests/generic/282
tests/generic/283

index 1355c6412448a8a8626b88a474b7a6450908e25f..af699144e9db1e3a73dd05366a5b678ed4767e20 100755 (executable)
@@ -66,8 +66,14 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
+# Insulate ourselves against bash reporting the SIGBUS when we try to modify
+# the metadata.
+cat > $tmp.run << ENDL
+ulimit -c 0
 $XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
        -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
        -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+ENDL
+bash $tmp.run 2> /dev/null
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
 _dmerror_load_working_table
 _dmerror_unmount
 _dmerror_mount
index 75c4b39ab164455b515f0f81827fc7d9b54a351a..75deab7c1f78efbcd5b8fa52cd13f3a171558398 100755 (executable)
@@ -66,8 +66,14 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
+# Insulate ourselves against bash reporting the SIGBUS when we try to modify
+# the metadata.
+cat > $tmp.run << ENDL
+ulimit -c 0
 $XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
        -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
 $XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
        -c "msync -s 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+ENDL
+bash $tmp.run 2> /dev/null
 
 echo "Clean up the mess"
 _dmerror_unmount
 
 echo "Clean up the mess"
 _dmerror_unmount
index aea7ce58492c94d4bcd868914b7274b2ea9248ac..44ffe2789b943a6971f63e2786696f7a69f8688f 100755 (executable)
@@ -66,7 +66,14 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+# Insulate ourselves against bash reporting the SIGBUS when we try to modify
+# the metadata.
+cat > $tmp.run << ENDL
+ulimit -c 0
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" \
+       -c "mwrite -S 0x63 0 $filesize" $testdir/file2 >> $seqres.full 2>&1
+ENDL
+bash $tmp.run 2> /dev/null
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
 _dmerror_load_working_table
 rm -rf $testdir/file2 >> $seqres.full 2>&1
 _dmerror_unmount
index 79caddb567865faef3b642a7baba8d68e0ebc57f..84a1666a6fe23b97cf858ecf02c851fa72dd9e1d 100755 (executable)
@@ -67,10 +67,16 @@ md5sum $testdir/file2 | _filter_scratch
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
 echo "CoW and unmount"
 sync
 _dmerror_load_error_table
-urk=$($XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
-       -c "msync -s 0 $filesize" $testdir/file2 2>&1)
-echo $urk >> $seqres.full
-echo "$urk" | grep -q "error" || _fail "mwrite did not fail"
+# Insulate ourselves against bash reporting the SIGBUS when we try to modify
+# the metadata.
+cat > $tmp.run << ENDL
+ulimit -c 0
+$XFS_IO_PROG -f -c "mmap -rw 0 $filesize" -c "mwrite -S 0x63 0 $filesize" \
+       -c "msync -s 0 $filesize" $testdir/file2 2>&1
+ENDL
+bash $tmp.run > $tmp.output 2>&1
+cat $tmp.output >> $seqres.full
+grep -q error $tmp.output || _fail "mwrite did not fail"
 _dmerror_load_working_table
 
 echo "Rewrite"
 _dmerror_load_working_table
 
 echo "Rewrite"