_init_flakey()
{
# Scratch device
- local BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
- export FLAKEY_DEV="/dev/mapper/$FLAKEY_NAME"
- FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 180 0"
- FLAKEY_TABLE_DROP="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 drop_writes"
- FLAKEY_TABLE_ERROR="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 0 180 1 error_writes"
+ if [ -z "$NON_FLAKEY_DEV" ]; then
+ # Set up the device switch
+ local backing_dev="$SCRATCH_DEV"
+ export NON_FLAKEY_DEV="$SCRATCH_DEV"
+ SCRATCH_DEV=/dev/mapper/$FLAKEY_NAME
+ else
+ # Already set up; recreate tables
+ local backing_dev="$NON_FLAKEY_DEV"
+ fi
+ local BLK_DEV_SIZE=`blockdev --getsz $backing_dev`
+ FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $backing_dev 0 180 0"
+ FLAKEY_TABLE_DROP="0 $BLK_DEV_SIZE flakey $backing_dev 0 0 180 1 drop_writes"
+ FLAKEY_TABLE_ERROR="0 $BLK_DEV_SIZE flakey $backing_dev 0 0 180 1 error_writes"
_dmsetup_create $FLAKEY_NAME --table "$FLAKEY_TABLE" || \
_fatal "failed to create flakey device"
fi
}
-_mount_flakey()
-{
- _scratch_options mount
-
- mount -t $FSTYP $SCRATCH_OPTIONS $MOUNT_OPTIONS $FLAKEY_DEV $SCRATCH_MNT
-}
-
-_unmount_flakey()
-{
- _unmount $SCRATCH_MNT
-}
-
_cleanup_flakey()
{
# If dmsetup load fails then we need to make sure to do resume here
# otherwise the umount will hang
test -n "$NON_FLAKEY_LOGDEV" && $DMSETUP_PROG resume $FLAKEY_LOGNAME &> /dev/null
test -n "$NON_FLAKEY_RTDEV" && $DMSETUP_PROG resume $FLAKEY_RTNAME &> /dev/null
- $DMSETUP_PROG resume flakey-test > /dev/null 2>&1
+ test -n "$NON_FLAKEY_DEV" && $DMSETUP_PROG resume flakey-test > /dev/null 2>&1
_unmount $SCRATCH_MNT > /dev/null 2>&1
- _dmsetup_remove $FLAKEY_NAME
+ test -n "$NON_FLAKEY_DEV" && _dmsetup_remove $FLAKEY_NAME
test -n "$NON_FLAKEY_LOGDEV" && _dmsetup_remove $FLAKEY_LOGNAME
test -n "$NON_FLAKEY_RTDEV" && _dmsetup_remove $FLAKEY_RTNAME
+ SCRATCH_DEV="$NON_FLAKEY_DEV"
+ unset NON_FLAKEY_DEV
+
if [ -n "$NON_FLAKEY_LOGDEV" ]; then
SCRATCH_LOGDEV="$NON_FLAKEY_LOGDEV"
unset NON_FLAKEY_LOGDEV
{
# If the full environment is set up, configure ourselves for shutdown
type _prepare_for_eio_shutdown &>/dev/null && \
- _prepare_for_eio_shutdown $FLAKEY_DEV
+ _prepare_for_eio_shutdown $SCRATCH_DEV
_load_flakey_table $FLAKEY_DROP_WRITES
- _unmount_flakey
+ _scratch_unmount
if [ "x$1" = "xyes" ]; then
- _check_scratch_fs $FLAKEY_DEV
+ _check_scratch_fs
fi
_load_flakey_table $FLAKEY_ALLOW_WRITES
- _mount_flakey
+ _scratch_mount
}
_require_flakey_with_error_writes()
_dmsetup_create $NAME --table "$TABLE" || \
_notrun "This test requires error_writes feature in dm-flakey"
- _cleanup_flakey
+ _dmsetup_remove $FLAKEY_NAME
}
_init_flakey
SAVE_MOUNT_OPTIONS="$MOUNT_OPTIONS"
MOUNT_OPTIONS="$MOUNT_OPTIONS $2"
- _mount_flakey
+ _scratch_mount
BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
echo "Verifying file bar2 content"
od -t x1 $SCRATCH_MNT/bar2 | _filter_od
- _unmount_flakey
+ _scratch_unmount
# Verify that there are no consistency errors.
- _check_scratch_fs $FLAKEY_DEV
+ _check_scratch_fs
_cleanup_flakey
MOUNT_OPTIONS="$SAVE_MOUNT_OPTIONS"
has_orphan_item()
{
INO=$1
- if $BTRFS_UTIL_PROG inspect-internal dump-tree $FLAKEY_DEV | \
+ if $BTRFS_UTIL_PROG inspect-internal dump-tree $SCRATCH_DEV | \
grep -q "key (ORPHAN ORPHAN_ITEM $INO)"; then
return 0
fi
_scratch_mkfs >> $seqres.full 2>&1
_init_flakey
- _mount_flakey
+ _scratch_mount
$PRECMD
exec 27>&-
# Orphan item should be on disk if operating correctly
- _unmount_flakey
+ _scratch_unmount
_load_flakey_table $FLAKEY_ALLOW_WRITES
if ! has_orphan_item $INO; then
echo "ERROR: No orphan item found after umount."
return
fi
- _mount_flakey
+ _scratch_mount
# If $DIR is a subvolume, this will cause a lookup and orphan cleanup
(cd $DIR; true)
# disk until there's a sync.
sync
- _unmount_flakey
+ _scratch_unmount
if has_orphan_item $INO; then
echo "ERROR: Orphan item found after successful mount/sync."
fi
SUB=$($BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT | $AWK_PROG '{print $2}')
_btrfs subvolume set-default $SUB $SCRATCH_MNT
- _unmount_flakey
- _mount_flakey
+ _scratch_unmount
+ _scratch_mount
}
echo "Testing with fs root as default subvolume"
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
echo "File contents after log replay:"
od -t x1 $SCRATCH_MNT/foo | _filter_od
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)
# the power failure happened.
od -t x1 $SCRATCH_MNT/foo | _filter_od
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create a snapshot at the root of our filesystem (mount point path), delete it,
# fsync the mount point path, crash and mount to replay the log. This should
[ -e $SCRATCH_MNT/testdir/snap2 ] && \
echo "Snapshot snap2 still exists after log replay"
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
_btrfs quota enable $SCRATCH_MNT
# Must match what he got before the power failure.
md5sum $SCRATCH_MNT/foobar | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir
populate_testdir
echo "Filesystem contents after the second log replay:"
ls -R $SCRATCH_MNT | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs -O no-holes -n $((64 * 1024)) >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
- _mount_flakey
+ _scratch_mount
# Create our test file with 832 extents of 256Kb each. Before each
# extent, there is a 256Kb hole (except for the first extent, which
echo "File digest after power failure and log replay:"
md5sum $SCRATCH_MNT/foobar | _filter_scratch
- _unmount_flakey
+ _scratch_unmount
_cleanup_flakey
}
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Enable qgroups on the filesystem. This will start the qgroup rescan kernel
# thread.
# fail.
_flakey_drop_and_remount
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
echo "Silence is golden"
_scratch_mkfs -O no-holes -n $((64 * 1024)) >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
- _mount_flakey
+ _scratch_mount
# Create our first file, which is used just to fill space in a leaf. Its
# items ocuppy most of the first leaf. We use a large xattr since it's an
echo "File digest after power failure and log replay:"
md5sum $SCRATCH_MNT/bar | _filter_scratch
- _unmount_flakey
+ _scratch_unmount
_cleanup_flakey
}
_scratch_mkfs -O no-holes -n $((64 * 1024)) >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
- _mount_flakey
+ _scratch_mount
# Create our first file, which is used just to fill space in a leaf. Its
# items ocuppy most of the first leaf. We use a large xattr since it's an
echo "File digest after power failure and log replay:"
md5sum $SCRATCH_MNT/bar | _filter_scratch
- _unmount_flakey
+ _scratch_unmount
_cleanup_flakey
}
_scratch_mkfs -O ^no-holes >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create a 256K file with a single extent and fsync it to clear the full sync
# bit from the inode - we want the msync below to trigger a fast fsync.
# We also want to check that fsck doesn't fail due to an error of a missing
# file extent item that represents a hole for the range 256K to 512K. The
# fstests framework does the fsck once the test exits.
-_unmount_flakey
+_scratch_unmount
status=0
exit
# Unmount the filesystem and run 'btrfs check'/fsck to verify that we don't
# have a missing hole for the file range from 64K to 128K.
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
- _mount_flakey
+ _scratch_mount
# Now write to the file range from 0 to 128K. After this we should still have
# rwo extents in our file, corresponding to the 2 extents we allocated before
_scratch_mkfs -O ^no-holes >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
echo "Testing without NO_HOLES feature"
run_test
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
_scratch_mkfs -O no-holes >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
echo
echo "Testing with the NO_HOLES feature"
run_test
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs -O no-holes >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with 3 extents of 256K and a 256K hole at offset 256K.
# The file has a size of 1280K.
echo "File data after power failure:"
od -A d -t x1 $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
check_subvol_orphan_item_exists()
{
# RW mount.
_load_flakey_table $FLAKEY_DROP_WRITES
exec 73>&-
- _unmount_flakey
+ _scratch_unmount
check_subvol_orphan_item_exists
check_subvol_btree_exists
# Use a commit interval lower than the default (30 seconds) so that the test
# is faster and we spend less time waiting for transaction commits.
MOUNT_OPTIONS="-o commit=1"
-_mount_flakey
+_scratch_mount
$BTRFS_UTIL_PROG subvolume sync $SCRATCH_MNT >>$seqres.full
-_unmount_flakey
+_scratch_unmount
check_subvol_orphan_item_not_exists
check_subvol_btree_not_exists
_cleanup_flakey
_scratch_mkfs >>$seqres.full 2>&1
_init_flakey
-_mount_flakey
+_scratch_mount
create_subvol_with_orphan
MOUNT_OPTIONS="-o ro,commit=1"
-_mount_flakey
+_scratch_mount
# The subvolume path should not be accessible anymore, even if deletion of the
# subvolume btree did not happen yet.
[ -e $SCRATCH_MNT/testsv ] && echo "subvolume path still exists"
-_unmount_flakey
+_scratch_unmount
# The subvolume btree should still exist, even though the path is not accessible.
check_subvol_btree_exists
check_subvol_orphan_item_exists
# Mount the filesystem RO again.
-_mount_flakey
+_scratch_mount
# Now remount RW, then unmount and then check the subvolume's orphan item, btree
# and path don't exist anymore.
MOUNT_OPTIONS="-o remount,rw"
-_mount_flakey
+_scratch_mount
$BTRFS_UTIL_PROG subvolume sync $SCRATCH_MNT >>$seqres.full
[ -e $SCRATCH_MNT/testsv ] && echo "subvolume path still exists"
-_unmount_flakey
+_scratch_unmount
check_subvol_orphan_item_not_exists
check_subvol_btree_not_exists
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
MOUNT_OPTIONS="-o datacow"
-_mount_flakey
+_scratch_mount
# Test a few times each scenario because this test was motivated by a race
# condition.
test_fsync "link_cow_$i" "link"
done
-_unmount_flakey
+_scratch_unmount
# Now lets test with nodatacow.
if ! _scratch_btrfs_is_zoned; then
MOUNT_OPTIONS="-o nodatacow"
- _mount_flakey
+ _scratch_mount
echo "Testing fsync after rename with NOCOW writes"
for ((i = 1; i <= 3; i++)); do
test_fsync "link_nocow_$i" "link"
done
- _unmount_flakey
+ _scratch_unmount
else
# Fake result. Zoned btrfs does not support NOCOW
echo "Testing fsync after rename with NOCOW writes"
_scratch_mkfs "-n 65536" >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# "testdir" is inode 257.
mkdir $SCRATCH_MNT/testdir
echo "File $SCRATCH_MNT/testdir/file1 data:" | _filter_scratch
od -A d -t x1 $SCRATCH_MNT/testdir/file1
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with 2 preallocated extents. Leave a 1M hole between them
# to ensure that we get two file extent items that will never be merged into a
echo "File content before after failure:"
od -A d -t x1 $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test files.
touch $SCRATCH_MNT/foo
[ -f $SCRATCH_MNT/foo2 ] || echo "File name foo2 does not exists"
[ -f $SCRATCH_MNT/foo ] && echo "File name foo still exists"
-_unmount_flakey
+_scratch_unmount
# success, all done
status=0
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/test_dir
touch $SCRATCH_MNT/test_dir/foo
rmdir $SCRATCH_MNT/test_dir
[ -d $SCRATCH_MNT/test_dir ] && echo "rmdir didn't succeed"
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create a test file with 2 hard links in the same directory.
mkdir -p $SCRATCH_MNT/a/b
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create a test file with 3001 hard links. This number is large enough to
# make btrfs start using extrefs at some point even if the fs has the maximum
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create a test file with 3001 hard links. This number is large enough to
# make btrfs start using extrefs at some point even if the fs has the maximum
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create one file with data and fsync it.
# This made the btrfs fsync log persist the data and the inode metadata with
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with some data.
$XFS_IO_PROG -f -c "pwrite -S 0xaa -b 8K 0 8K" \
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file.
$XFS_IO_PROG -f -c "pwrite -S 0x22 -b 16K 0 16K" \
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our main test file and directory.
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 8K" $SCRATCH_MNT/foo | _filter_xfs_io
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create out test file and add 3 xattrs to it.
touch $SCRATCH_MNT/foobar
echo "xattr names and values after second fsync log replay:"
_getfattr --absolute-names --dump $SCRATCH_MNT/foobar | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our main test file 'foo', the one we check for data loss.
# By doing an fsync against our file, it makes btrfs clear the 'needs_full_sync'
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create the test file with some initial data and then fsync it.
# The fsync here is only needed to trigger the issue in btrfs, as it causes the
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test files and make sure everything is durably persisted.
$XFS_IO_PROG -f -c "pwrite -S 0xaa 0 64K" \
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directory and files.
mkdir $SCRATCH_MNT/testdir
rm -f $SCRATCH_MNT/testdir/*
rmdir $SCRATCH_MNT/testdir
-_unmount_flakey
+_scratch_unmount
# The fstests framework will call fsck against our filesystem which will verify
# that all metadata is in a consistent state.
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with 2 hard links.
mkdir $SCRATCH_MNT/testdir
rm -f $SCRATCH_MNT/testdir/*
rmdir $SCRATCH_MNT/testdir
-_unmount_flakey
+_scratch_unmount
# The fstests framework will call fsck against our filesystem which will verify
# that all metadata is in a consistent state.
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directory and file.
mkdir $SCRATCH_MNT/testdir
rm -f $SCRATCH_MNT/testdir/*
rmdir $SCRATCH_MNT/testdir
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
BLOCK_SIZE=$(_get_file_block_size $SCRATCH_MNT)
# Must match the same extent listing we got before the power failure.
$XFS_IO_PROG -c "fiemap -v" $SCRATCH_MNT/foobar | _filter_fiemap $BLOCK_SIZE
-_unmount_flakey
+_scratch_unmount
status=0
exit
_md5_checksum $testfile
_load_flakey_table $FLAKEY_DROP_WRITES $lockfs
- _unmount_flakey
+ _scratch_unmount
#Ok mount so that any recovery that needs to happen is done
_load_flakey_table $FLAKEY_ALLOW_WRITES
- _mount_flakey
+ _scratch_mount
_md5_checksum $testfile
#Unmount and fsck to make sure we got a valid fs after replay
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
[ $? -ne 0 ] && _fatal "fsck failed"
- _mount_flakey
+ _scratch_mount
}
_scratch_mkfs >> $seqres.full 2>&1
# Create a basic flakey device that will never error out
_init_flakey
-_mount_flakey
+_scratch_mount
buffered=0
direct=1
_clean_working_dir()
{
- _mount_flakey
+ _scratch_mount
rm -rf $SCRATCH_MNT/foo $SCRATCH_MNT/bar
- _unmount_flakey
+ _scratch_unmount
}
# Btrfs wasn't making sure the directory survived fsync
_directory_test()
{
echo "fsync new directory"
- _mount_flakey
+ _scratch_mount
mkdir $SCRATCH_MNT/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/bar
_flakey_drop_and_remount
_ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }'
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
[ $? -ne 0 ] && _fatal "fsck failed"
}
_rename_test()
{
echo "rename fsync test"
- _mount_flakey
+ _scratch_mount
touch $SCRATCH_MNT/foo
mkdir $SCRATCH_MNT/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
_ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }'
_ls_l $SCRATCH_MNT/bar | tail -n +2 | awk '{ print $1, $9 }'
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
[ $? -ne 0 ] && _fatal "fsck failed"
}
_replay_rename_test()
{
echo "replay rename fsync test"
- _mount_flakey
+ _scratch_mount
touch $SCRATCH_MNT/foo
mkdir $SCRATCH_MNT/bar
$XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foo
_ls_l $SCRATCH_MNT | tail -n +2 | awk '{ print $1, $9 }'
_ls_l $SCRATCH_MNT/bar | tail -n +2 | awk '{ print $1, $9 }'
- _unmount_flakey
+ _scratch_unmount
}
_scratch_mkfs >> $seqres.full 2>&1
_clean_working_dir()
{
- _mount_flakey
+ _scratch_mount
rm -rf $SCRATCH_MNT/foo $SCRATCH_MNT/bar
- _unmount_flakey
+ _scratch_unmount
}
# Btrfs wasn't making sure the new file after rename survived the fsync
_rename_test()
{
echo "fsync rename test"
- _mount_flakey
+ _scratch_mount
$XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" $SCRATCH_MNT/foo \
>> $seqres.full 2>&1
mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
_flakey_drop_and_remount
md5sum $SCRATCH_MNT/bar | _filter_scratch
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
[ $? -ne 0 ] && _fatal "fsck failed"
}
_write_after_fsync_rename_test()
{
echo "fsync rename test"
- _mount_flakey
+ _scratch_mount
$XFS_IO_PROG -f -c "pwrite 0 1M" -c "fsync" -c "pwrite 2M 1M" \
-c "sync_range -b 2M 1M" $SCRATCH_MNT/foo >> $seqres.full 2>&1
mv $SCRATCH_MNT/foo $SCRATCH_MNT/bar
_flakey_drop_and_remount
md5sum $SCRATCH_MNT/bar | _filter_scratch
- _unmount_flakey
+ _scratch_unmount
}
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create the file first.
$XFS_IO_PROG -f -c "pwrite -S 0xff 0 256K" $SCRATCH_MNT/foo | _filter_xfs_io
echo "File content after crash/reboot and fs mount:"
od -t x1 $SCRATCH_MNT/foo
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directories and the file we will later check if it has
# disappeared.
# Must match what we had before the power failure.
ls -R $SCRATCH_MNT/a $SCRATCH_MNT/c | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directories and the file we will later check if it has
# disappeared (file bar).
# Must match what we had before the power failure.
ls -R $SCRATCH_MNT/a $SCRATCH_MNT/b $SCRATCH_MNT/c | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir -p $SCRATCH_MNT/a/x
$XFS_IO_PROG -f -c "pwrite -S 0xaf 0 32K" $SCRATCH_MNT/a/x/foo | _filter_xfs_io
md5sum $SCRATCH_MNT/a/y/foo | _filter_scratch
md5sum $SCRATCH_MNT/a/y/bar | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
fi
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/a
$XFS_IO_PROG -f -c "pwrite -S 0xf1 0 16K" $SCRATCH_MNT/a/foo | _filter_xfs_io
md5sum $SCRATCH_MNT/a/foo | _filter_scratch
md5sum $SCRATCH_MNT/a/bar | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directories and files.
mkdir $SCRATCH_MNT/x
echo "Filesystem contents after log replay:"
ls -R $SCRATCH_MNT/x $SCRATCH_MNT/y | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir1
# Make sure it's durably persisted.
readlink $SCRATCH_MNT/testdir1/bar1 | _filter_scratch
readlink $SCRATCH_MNT/testdir2/bar2 | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directories and files.
mkdir $SCRATCH_MNT/dir
echo "Filesystem contents after log replay:"
ls -R $SCRATCH_MNT/dir | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# See this post for reverse engineering of this auto generated test:
# https://marc.info/?l=linux-ext4&m=151137380830381&w=2
run_check $FSX_PROG -d --replay-ops $fsxops $SCRATCH_MNT/testfile
_flakey_drop_and_remount
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
_check_scratch_fs
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
- _mount_flakey
+ _scratch_mount
mkdir $SCRATCH_MNT/testdir
case $file_type in
# replaying the fsync log/journal succeeds, that is the mount operation
# does not fail.
_flakey_drop_and_remount
- _unmount_flakey
+ _scratch_unmount
_cleanup_flakey
}
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir
touch $SCRATCH_MNT/testdir/foo
# the fsync log/journal succeeds, that is the mount operation does not fail.
_flakey_drop_and_remount
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
echo "Silence is golden"
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# create a file and keep it in write ahead log
$XFS_IO_PROG -f -c "fsync" $SCRATCH_MNT/foo
# see if we can create a new file successfully
touch $SCRATCH_MNT/bar
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# The fiemap results in the golden output requires file allocations to align to
# 256K boundaries.
echo "File baz size:"
stat --format %s $SCRATCH_MNT/baz
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
touch $SCRATCH_MNT/foobar
$SETFATTR_PROG -n user.xa1 -v qwerty $SCRATCH_MNT/foobar
echo "File data after power failure:"
od -t x1 $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/A
mkdir $SCRATCH_MNT/B
[ -d $SCRATCH_MNT/A ] || echo "directory A missing"
[ -f $SCRATCH_MNT/B/foo ] || echo "file B/foo is missing"
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
_require_congruent_file_oplen $SCRATCH_MNT 2097152
# Use file sizes and offsets/lengths for the clone operation that are multiples
echo "File bar digest after power failure:"
md5sum $SCRATCH_MNT/bar | _filter_scratch
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
status=0
fi
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with 2 hard links in the same parent directory.
mkdir $SCRATCH_MNT/testdir
echo "Contents of test directory after the power failure:"
ls -R $SCRATCH_MNT/testdir | _filter_scratch
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our tmpfile, write some data to it and fsync it. We want a power
# failure to happen after the fsync, so that we have an inode with a link
# Simulate a power failure and mount the filesystem to check that it succeeds.
_flakey_drop_and_remount
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directories and file.
mkdir $SCRATCH_MNT/testdir
echo "Filesystem content after power failure:"
ls -R $SCRATCH_MNT/testdir | _filter_scratch
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
$XFS_IO_PROG -f \
-c "pwrite -S 0xb6 0 21" \
echo "File content after power failure:"
od -t x1 -A d $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
status=0
exit
# adds about 10 seconds of delay in total for the 37 tests.
clean_dir()
{
- _mount_flakey
+ _scratch_mount
rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found")
- _unmount_flakey
+ _scratch_unmount
}
check_consistency()
echo "After: $after"
fi
- _unmount_flakey
- _check_scratch_fs $FLAKEY_DEV
+ _scratch_unmount
+ _check_scratch_fs
}
# create a hard link $2 to file $1, and fsync $3, followed by power-cut
echo -ne "\n=== link $src $dest with fsync $fsync ===\n" | \
_filter_scratch
- _mount_flakey
+ _scratch_mount
# Now execute the workload
# Create the directory in which the source and destination files
before=""
after=""
echo -ne "\n=== link $src $dest with sync ===\n" | _filter_scratch
- _mount_flakey
+ _scratch_mount
# now execute the workload
# Create the directory in which the source and destination files
fi
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir
echo -n "foo" > $SCRATCH_MNT/testdir/fname1
echo "File fname3 data after power failure: $(cat $SCRATCH_MNT/testdir/fname3)"
echo "File fname4 data after power failure: $(cat $SCRATCH_MNT/testdir/fname4)"
-_unmount_flakey
+_scratch_unmount
status=0
exit
fi
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir
echo -n "foo" > $SCRATCH_MNT/testdir/fname1
echo "File zz data after power failure: $(cat $SCRATCH_MNT/testdir2/zz)"
echo "File zz_link data after power failure: $(cat $SCRATCH_MNT/testdir2/zz_link)"
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file with an initial size of 8000 bytes, then fsync it,
# followed by a truncate that reduces its size down to 3000 bytes.
echo "File content after power failure:"
od -A d -t x1 $SCRATCH_MNT/bar
-_unmount_flakey
+_scratch_unmount
status=0
exit
local target=$1
local is_dir=$2
- _mount_flakey
+ _scratch_mount
if [ $is_dir = 1 ]; then
mkdir $target
else
rm -f $target
fi
- _unmount_flakey
+ _scratch_unmount
}
echo "Silence is golden"
_scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
_require_congruent_file_oplen $SCRATCH_MNT 4096
# Create preallocated extent where we can write into
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/test
args=`_scale_fsstress_args -p 4 -n 100 -d $SCRATCH_MNT/test`
# must match.
$FSSUM_PROG -r $fssum_files_dir/fs_digest $SCRATCH_MNT/test
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directory with two files in it.
mkdir $SCRATCH_MNT/dir
echo "File data after power failure:"
od -t x1 -A d $SCRATCH_MNT/dir/baz
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directory with one file in it and fsync the file.
mkdir $SCRATCH_MNT/dir
[ -f $SCRATCH_MNT/dir/foo ] && echo "File foo still exists"
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
_require_congruent_file_oplen $SCRATCH_MNT 65536
echo "File digest after mount:"
_md5_checksum $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create two test directories, one with a file we will rename later.
mkdir $SCRATCH_MNT/A
[ -f $SCRATCH_MNT/A/bar ] || echo "File A/bar is missing"
[ -f $SCRATCH_MNT/baz ] || echo "File baz is missing"
-_unmount_flakey
+_scratch_unmount
status=0
exit
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# The fiemap results in the golden output requires file allocations to align to
# 1MB boundaries.
echo "List of extents after power failure:"
$XFS_IO_PROG -c "fiemap -v" $SCRATCH_MNT/foo | _filter_fiemap
-_unmount_flakey
+_scratch_unmount
# success, all done
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test directory.
mkdir "$SCRATCH_MNT"/testdir
symlink_content=$(readlink "$SCRATCH_MNT"/testdir/baz | _filter_scratch)
echo "symlink content: ${symlink_content}"
-_unmount_flakey
+_scratch_unmount
# success, all done
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# We punch 2M holes and require extent allocations to align to 2M in fiemap
# results.
echo "File content after power failure:"
_hexdump $SCRATCH_MNT/foobar
-_unmount_flakey
+_scratch_unmount
# success, all done
status=0
_scratch_mkfs >>$seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# We do 64K writes in the fio job.
_require_congruent_file_oplen $SCRATCH_MNT $((64 * 1024))
echo "Digest after power failure: $digest_after"
fi
-_unmount_flakey
+_scratch_unmount
# success, all done
echo "Silence is golden"
_unmount $extra_mnt &> /dev/null
_unmount $extra_mnt &> /dev/null
rm -rf $extra_mnt
- _unmount_flakey
+ _scratch_unmount
_cleanup_flakey
cd /
rm -r -f $tmp.*
_scratch_mkfs >> $seqres.full
_init_flakey
-_mount_flakey
+_scratch_mount
extra_mnt=$TEST_DIR/extra_mnt
rm -rf $extra_mnt
# Mount must fail because the physical device has a dm created on it.
# Filters alter the return code of the mount.
-_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
- _filter_testdir_and_scratch | _filter_error_mount
+_mount $NON_FLAKEY_DEV $extra_mnt 2>/dev/null && \
+ _fail "mount of busy device succeeded"
-# Try again with flakey unmounted, must fail.
-_unmount_flakey
-_mount $SCRATCH_DEV $extra_mnt 2>&1 | \
- _filter_testdir_and_scratch | _filter_error_mount
+# Try again with flakey unmounted, must also fail.
+_scratch_unmount
+_mount $NON_FLAKEY_DEV $extra_mnt 2>/dev/null && \
+ _fail "mount of busy device succeeded"
# Removing dm should make mount successful.
_cleanup_flakey
QA output created by 741
-mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
-mount: TEST_DIR/extra_mnt: SCRATCH_DEV already mounted or mount point busy
_scratch_mkfs >> $seqres.full 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create the test file with some initial data and make sure everything is
# durably persisted.
_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
mkdir $SCRATCH_MNT/testdir
$here/src/multi_open_unlink -f $SCRATCH_MNT/testdir/foo -F -S -n 1 -s 0
# more hard links.
ls $SCRATCH_MNT/testdir
-_unmount_flakey
+_scratch_unmount
echo "Silence is golden"
status=0
_scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our first test file with some data.
mkdir $SCRATCH_MNT/testdir
_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test dir and add a symlink inside it.
mkdir $SCRATCH_MNT/dir
[ -L $SCRATCH_MNT/dir/new-slink ] || echo "symlink dir/new-slink not found"
echo "symlink content: $(readlink $SCRATCH_MNT/dir/new-slink)"
-_unmount_flakey
+_scratch_unmount
# success, all done
_exit 0
_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our test file.
touch $SCRATCH_MNT/foo
echo "File data:"
_hexdump $SCRATCH_MNT/foo
-_unmount_flakey
+_scratch_unmount
_exit 0
_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
list_fs_contents()
{
echo -e "\nfs contents after power failure:\n"
list_fs_contents
-_unmount_flakey
+_scratch_unmount
# success, all done
_exit 0
_scratch_mkfs >>$seqres.full 2>&1 || _fail "mkfs failed"
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
-_mount_flakey
+_scratch_mount
# Create our first test file.
echo -n > $SCRATCH_MNT/file1
# failure and after the last fsync.
$FSSUM_PROG -r $tmp.fssum $SCRATCH_MNT/
-_unmount_flakey
+_scratch_unmount
# success, all done
_exit 0
_scratch_unmount
# Initialize a dm-flakey device that will pass I/Os for 5s and fail thereafter.
-_init_flakey
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 5 180"
+_init_flakey
_load_flakey_table $FLAKEY_ALLOW_WRITES
# Set a 10s log recovery delay and mount the flakey device. This should allow
# The mount should fail due to dm-flakey. Note that this is dangerous on kernels
# without the xfs_buf log recovery race fixes.
-_mount_flakey > /dev/null 2>&1
+_scratch_mount > /dev/null 2>&1
echo 0 > /sys/fs/xfs/debug/log_recovery_delay
sysctl -w fs.xfs.xfssyncd_centisecs=${interval} >/dev/null 2>&1
cd /
rm -f $tmp.*
- _unmount_flakey >/dev/null 2>&1
+ _scratch_unmount >/dev/null 2>&1
_cleanup_flakey > /dev/null 2>&1
}
_scratch_mkfs > $seqres.full 2>&1
+# this needs to happen after mkfs, but before _init_flakey overrides SCRATCH_DEV
+FLAKEY_TABLE_NON_LOG_ERROR=$(make_xfs_scratch_flakey_table)
+
# no error will be injected
_init_flakey
+FLAKEY_TABLE_ERROR=${FLAKEY_TABLE_NON_LOG_ERROR}
$DMSETUP_PROG info >> $seqres.full
$DMSETUP_PROG table >> $seqres.full
sysctl -w fs.xfs.xfssyncd_centisecs=100 >> $seqres.full 2>&1
_qmount_option "usrquota"
-_mount_flakey
+_scratch_mount
# We need to set the quota limitation twice, and inject the write error
# after the second setting. If we try to inject the write error after
xfs_freeze -u $SCRATCH_MNT
# inject write IO error
-FLAKEY_TABLE_ERROR=$(make_xfs_scratch_flakey_table)
_load_flakey_table ${FLAKEY_ERROR_WRITES}
$DMSETUP_PROG info >> $seqres.full
$DMSETUP_PROG table >> $seqres.full
# the completion of the retried write of dquota buffer
sleep 2
-_unmount_flakey
+_scratch_unmount
_cleanup_flakey
_scratch_mkfs >> $seqres.full
_init_flakey
-_mount_flakey
+_scratch_mount
blksz=$(_get_file_block_size $SCRATCH_MNT)
# Try a post-fail reflink and then unmount. Both of these are known to produce
# errors and/or assert failures on XFS if we trip over a stale delalloc block.
_cp_reflink $SCRATCH_MNT/file2 $SCRATCH_MNT/file3
-_unmount_flakey
+_scratch_unmount
# success, all done
status=0
echo "Initialize and mount filesystem on flakey device"
_init_flakey
_load_flakey_table $FLAKEY_ALLOW_WRITES
-_mount_flakey
+_scratch_mount
echo "Create test file"
$XFS_IO_PROG -s -f -c "pwrite 0 5M" $testfile >> $seqres.full
$here/src/punch-alternating $testfile
echo "Mount cycle the filesystem on flakey device"
-_unmount_flakey
-_mount_flakey
+_scratch_unmount
+_scratch_mount
-device=$(readlink -f $FLAKEY_DEV)
+device=$(readlink -f $SCRATCH_DEV)
device=$(_short_dev $device)
echo "Pin log items in the AIL"
echo 0 > /sys/fs/xfs/${device}/errortag/log_item_pin
echo "Unmount filesystem on flakey device"
-_unmount_flakey
+_scratch_unmount
echo "Clean up flakey device"
_cleanup_flakey