_scratch_mount "$opts"
}
+_scratch_shutdown()
+{
+ if [ $FSTYP = "overlay" ]; then
+ # In lagacy overlay usage, it may specify directory as
+ # SCRATCH_DEV, in this case OVL_BASE_SCRATCH_DEV
+ # will be null, so check OVL_BASE_SCRATCH_DEV before
+ # running shutdown to avoid shutting down base fs accidently.
+ if [ -z $OVL_BASE_SCRATCH_DEV ]; then
+ _fail "_scratch_shutdown: call _require_scratch_shutdown first in test"
+ else
+ src/godown $* $OVL_BASE_SCRATCH_MNT
+ fi
+ else
+ src/godown $* $SCRATCH_MNT
+ fi
+}
+
_test_mount()
{
if [ "$FSTYP" == "overlay" ]; then
{
[ -x src/godown ] || _notrun "src/godown executable not found"
- _scratch_mkfs > /dev/null 2>&1
- _scratch_mount
- src/godown -f $SCRATCH_MNT 2>&1 \
- || _notrun "$FSTYP does not support shutdown"
+ _scratch_mkfs > /dev/null 2>&1 || _notrun "_scratch_mkfs failed on $SCRATCH_DEV"
+ _scratch_mount || _notrun "_scratch_mount failed on $SCRATCH_MNT"
+
+ if [ $FSTYP = "overlay" ]; then
+ if [ -z $OVL_BASE_SCRATCH_DEV ]; then
+ # In lagacy overlay usage, it may specify directory as
+ # SCRATCH_DEV, in this case OVL_BASE_SCRATCH_DEV
+ # will be null, so check OVL_BASE_SCRATCH_DEV before
+ # running shutdown to avoid shutting down base fs accidently.
+ _notrun "$SCRATCH_DEV is not a block device"
+ else
+ src/godown -f $OVL_BASE_SCRATCH_MNT 2>&1 \
+ || _notrun "Underlying filesystem does not support shutdown"
+ fi
+ else
+ src/godown -f $SCRATCH_MNT 2>&1 \
+ || _notrun "$FSTYP does not support shutdown"
+ fi
+
_scratch_unmount
}
_require_xfs_io_command "fzero"
_scratch_mkfs >/dev/null 2>&1
+_require_local_device $SCRATCH_DEV
_require_metadata_journaling $SCRATCH_DEV
_scratch_mount
# give the system a chance to write something out
sleep 10
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
# give the system a chance to write something out
sleep 10
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
# give the system a chance to write something out
sleep 10
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
# give the system a chance to write something out
sleep 10
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
done
# shutdown immediately after, then remount and test
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
_scratch_unmount
# sync, then shutdown immediately after, then remount and test
sync
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
_scratch_unmount
# sync, then shutdown immediately after, then remount and test
sync
-src/godown $SCRATCH_MNT
+_scratch_shutdown
_scratch_unmount
_scratch_mount
_scratch_unmount
_supported_fs generic
_supported_os Linux
+_require_local_device $SCRATCH_DEV
_require_scratch_nocheck
_require_scratch_shutdown
_require_norecovery
# now shutdown and unmount
sleep 5
-$here/src/godown $load_dir
+_scratch_shutdown
$KILLALL_PROG -q $FSSTRESS_PROG
wait
touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
echo "godown"
-src/godown -v -f $SCRATCH_MNT >> $seqres.full
+_scratch_shutdown -v -f >> $seqres.full
echo "unmount"
_scratch_unmount
ls $SCRATCH_MNT | _filter_lostfound
_echofull "godown"
- src/godown -v -f $SCRATCH_MNT >> $seqres.full
+ _scratch_shutdown -v -f >> $seqres.full
_echofull "unmount"
_scratch_unmount >>$seqres.full 2>&1 \
ls -RF $SCRATCH_MNT >$tmp.ls1
_echofull "godown"
- src/godown -v -f $SCRATCH_MNT >> $seqres.full
+ _scratch_shutdown -v -f >> $seqres.full
_echofull "unmount"
_scratch_unmount >>$seqres.full 2>&1 \
_supported_os Linux
_require_scratch
+_require_local_device $SCRATCH_DEV
_require_scratch_shutdown
_require_command "$KILLALL_PROG" "killall"
# purposely include 0 second sleeps to test shutdown immediately after
# recovery
sleep $((RANDOM % 3))
- ./src/godown $SCRATCH_MNT
+ _scratch_shutdown
ps -e | grep fsstress > /dev/null 2>&1
while [ $? -eq 0 ]; do
before=`stat "$stat_opt" $testfile`
$XFS_IO_PROG -c "$sync_mode" $testfile | _filter_xfs_io
- src/godown $SCRATCH_MNT | tee -a $seqres.full
+ _scratch_shutdown | tee -a $seqres.full
_scratch_cycle_mount
after=`stat "$stat_opt" $testfile`
sleep 3
echo "godown"
- src/godown -v -f $SCRATCH_MNT >> $seqres.full
+ _scratch_shutdown -v -f >> $seqres.full
# kill the multi_open_unlink
kill $pid 2>/dev/null
# now shutdown and unmount
sleep 5
-$here/src/godown $load_dir
+_scratch_shutdown
$KILLALL_PROG -q $FSSTRESS_PROG
wait
before=`stat "$stat_opt" $testfile`
$XFS_IO_PROG -c "$sync_mode" $testfile | _filter_xfs_io
- $here/src/godown $SCRATCH_MNT | tee -a $seqres.full
+ _scratch_shutdown | tee -a $seqres.full
_scratch_cycle_mount
after=`stat "$stat_opt" $testfile`