@@ -352,7 +352,7 @@ _btrfs_stress_subvolume()
while [ ! -e $stop_file ]; do
$BTRFS_UTIL_PROG subvolume create $btrfs_mnt/$subvol_name
$MOUNT_PROG -o subvol=$subvol_name $btrfs_dev $subvol_mnt
- $UMOUNT_PROG $subvol_mnt
+ _unmount $subvol_mnt
$BTRFS_UTIL_PROG subvolume delete $btrfs_mnt/$subvol_name
done
}
@@ -368,7 +368,7 @@ _btrfs_kill_stress_subvolume_pid()
# Ignore if process already died.
wait $subvol_pid &> /dev/null
rm -f $stop_file
- $UMOUNT_PROG $subvol_mnt &> /dev/null
+ _unmount $subvol_mnt &> /dev/null
}
# stress btrfs by running scrub in a loop
@@ -28,7 +28,7 @@ _mount_delay()
_unmount_delay()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
_cleanup_delay()
@@ -36,7 +36,7 @@ _cleanup_delay()
# If dmsetup load fails then we need to make sure to do resume here
# otherwise the umount will hang
$DMSETUP_PROG resume $DELAY_NAME > /dev/null 2>&1
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove $DELAY_NAME
}
@@ -24,7 +24,7 @@ _mount_dust()
_unmount_dust()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
_cleanup_dust()
@@ -32,6 +32,6 @@ _cleanup_dust()
# If dmsetup load fails then we need to make sure to do resume here
# otherwise the umount will hang
$DMSETUP_PROG resume $DUST_NAME > /dev/null 2>&1
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove $DUST_NAME
}
@@ -101,7 +101,7 @@ _dmerror_mount()
_dmerror_unmount()
{
- umount $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
_dmerror_cleanup()
@@ -110,7 +110,7 @@ _dmerror_cleanup()
test -n "$NON_ERROR_RTDEV" && $DMSETUP_PROG resume $DMERROR_RTNAME &>/dev/null
$DMSETUP_PROG resume $DMERROR_NAME > /dev/null 2>&1
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
test -n "$NON_ERROR_LOGDEV" && _dmsetup_remove $DMERROR_LOGNAME
test -n "$NON_ERROR_RTDEV" && _dmsetup_remove $DMERROR_RTNAME
@@ -71,7 +71,7 @@ _mount_flakey()
_unmount_flakey()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
_cleanup_flakey()
@@ -82,7 +82,7 @@ _cleanup_flakey()
test -n "$NON_FLAKEY_RTDEV" && $DMSETUP_PROG resume $FLAKEY_RTNAME &> /dev/null
$DMSETUP_PROG resume flakey-test > /dev/null 2>&1
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove $FLAKEY_NAME
test -n "$NON_FLAKEY_LOGDEV" && _dmsetup_remove $FLAKEY_LOGNAME
@@ -42,7 +42,7 @@ _dmhugedisk_init()
_dmhugedisk_cleanup()
{
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove $DMHUGE_TEST
_dmsetup_remove $DMHUGE_TEST_ZERO
}
@@ -110,7 +110,7 @@ _log_writes_mount()
_log_writes_unmount()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
# _log_writes_replay_log <mark>
@@ -141,7 +141,7 @@ _log_writes_remove()
_log_writes_cleanup()
{
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_log_writes_remove
}
@@ -23,7 +23,7 @@ DMTHIN_VOL_DEV="/dev/mapper/$DMTHIN_VOL_NAME"
_dmthin_cleanup()
{
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_dmsetup_remove $DMTHIN_VOL_NAME
_dmsetup_remove $DMTHIN_POOL_NAME
_dmsetup_remove $DMTHIN_META_NAME
@@ -32,7 +32,7 @@ _dmthin_cleanup()
_dmthin_check_fs()
{
- $UMOUNT_PROG $SCRATCH_MNT > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
_check_scratch_fs $DMTHIN_VOL_DEV
}
@@ -142,18 +142,18 @@ _overlay_base_unmount()
[ -n "$dev" -a -n "$mnt" ] || return 0
- $UMOUNT_PROG $mnt
+ _unmount $mnt
}
_overlay_test_unmount()
{
- $UMOUNT_PROG $TEST_DIR
+ _unmount $TEST_DIR
_overlay_base_unmount "$OVL_BASE_TEST_DEV" "$OVL_BASE_TEST_DIR"
}
_overlay_scratch_unmount()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
_overlay_base_unmount "$OVL_BASE_SCRATCH_DEV" "$OVL_BASE_SCRATCH_MNT"
}
@@ -342,7 +342,7 @@ _overlay_check_scratch_dirs()
# Need to umount overlay for scratch dir check
local ovl_mounted=`_is_dir_mountpoint $SCRATCH_MNT`
- [ -z "$ovl_mounted" ] || $UMOUNT_PROG $SCRATCH_MNT
+ [ -z "$ovl_mounted" ] || _unmount $SCRATCH_MNT
# Check dirs with extra overlay options
_overlay_check_dirs $lowerdir $upperdir $workdir $*
@@ -387,7 +387,7 @@ _overlay_check_fs()
else
# Check and umount overlay for dir check
ovl_mounted=`_is_dir_mountpoint $ovl_mnt`
- [ -z "$ovl_mounted" ] || $UMOUNT_PROG $ovl_mnt
+ [ -z "$ovl_mounted" ] || _unmount $ovl_mnt
fi
_overlay_check_dirs $base_mnt/$OVL_LOWER $base_mnt/$OVL_UPPER \
@@ -517,7 +517,7 @@ _scratch_xfs_populate() {
__populate_fragment_file "${SCRATCH_MNT}/RTRMAPBT"
__populate_fragment_file "${SCRATCH_MNT}/REFCOUNTBT"
- umount "${SCRATCH_MNT}"
+ _scratch_unmount
}
# Populate an ext4 on the scratch device with (we hope) all known
@@ -619,7 +619,7 @@ _scratch_ext4_populate() {
# Make sure we get all the fragmentation we asked for
__populate_fragment_file "${SCRATCH_MNT}/S_IFREG.FMT_ETREE"
- umount "${SCRATCH_MNT}"
+ _scratch_unmount
}
# Find the inode number of a file
@@ -772,7 +772,7 @@ _scratch_xfs_populate_check() {
dblksz="$(_xfs_get_dir_blocksize "$SCRATCH_MNT")"
leaf_lblk="$((32 * 1073741824 / blksz))"
node_lblk="$((64 * 1073741824 / blksz))"
- umount "${SCRATCH_MNT}"
+ _scratch_unmount
__populate_check_xfs_dformat "${extents_file}" "extents"
__populate_check_xfs_dformat "${btree_file}" "btree"
@@ -885,7 +885,7 @@ _scratch_ext4_populate_check() {
extents_slink="$(__populate_find_inode "${SCRATCH_MNT}/S_IFLNK.FMT_EXTENTS")"
local_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_LOCAL")"
block_attr="$(__populate_find_inode "${SCRATCH_MNT}/ATTR.FMT_BLOCK")"
- umount "${SCRATCH_MNT}"
+ _scratch_unmount
__populate_check_ext4_dformat "${extents_file}" "extents"
__populate_check_ext4_dformat "${etree_file}" "etree"
@@ -301,7 +301,7 @@ _put_mount()
local last_mnt=`echo $MOUNTED_POINT_STACK | awk '{print $1}'`
if [ -n "$last_mnt" ]; then
- $UMOUNT_PROG $last_mnt
+ _unmount $last_mnt
fi
MOUNTED_POINT_STACK=`echo $MOUNTED_POINT_STACK | cut -d\ -f2-`
}
@@ -310,7 +310,7 @@ _put_mount()
_clear_mount_stack()
{
if [ -n "$MOUNTED_POINT_STACK" ]; then
- $UMOUNT_PROG $MOUNTED_POINT_STACK
+ _unmount -R $MOUNTED_POINT_STACK
fi
MOUNTED_POINT_STACK=""
}
@@ -448,6 +448,14 @@ _scratch_mount_idmapped()
fi
}
+# Unmount the filesystem based on the directory or device passed.
+_unmount()
+{
+ local args="$*"
+
+ $UMOUNT_PROG $args >> $seqres.full 2>&1
+}
+
_scratch_unmount()
{
case "$FSTYP" in
@@ -455,20 +463,20 @@ _scratch_unmount()
_overlay_scratch_unmount
;;
btrfs)
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
;;
tmpfs)
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
;;
*)
- $UMOUNT_PROG $SCRATCH_DEV
+ _unmount $SCRATCH_DEV
;;
esac
}
_scratch_umount_idmapped()
{
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
}
_scratch_remount()
@@ -492,7 +500,7 @@ _scratch_cycle_mount()
;;
overlay)
if [ "$OVL_BASE_FSTYP" = tmpfs ]; then
- $UMOUNT_PROG $SCRATCH_MNT
+ _unmount $SCRATCH_MNT
unmounted=true
fi
;;
@@ -540,9 +548,9 @@ _move_mount()
# Replace $mnt with $tmp. Use a temporary bind-mount because
# mount --move will fail with certain mount propagation layouts.
- $UMOUNT_PROG $mnt || _fail "Failed to unmount $mnt"
+ _unmount $mnt || _fail "Failed to unmount $mnt"
_mount --bind $tmp $mnt || _fail "Failed to bind-mount $tmp to $mnt"
- $UMOUNT_PROG $tmp || _fail "Failed to unmount $tmp"
+ _unmount $tmp || _fail "Failed to unmount $tmp"
rmdir $tmp
}
@@ -608,7 +616,7 @@ _test_unmount()
if [ "$FSTYP" == "overlay" ]; then
_overlay_test_unmount
else
- $UMOUNT_PROG $TEST_DEV
+ _unmount $TEST_DEV
fi
}
@@ -622,7 +630,7 @@ _test_cycle_mount()
;;
overlay)
if [ "$OVL_BASE_FSTYP" = tmpfs ]; then
- $UMOUNT_PROG $TEST_DIR
+ _unmount $TEST_DIR
unmounted=true
fi
;;
@@ -1376,7 +1384,7 @@ _repair_scratch_fs()
_scratch_xfs_repair -L 2>&1
echo "log zap returns $?"
else
- umount "$SCRATCH_MNT"
+ _unmount "$SCRATCH_MNT"
fi
_scratch_xfs_repair "$@" 2>&1
res=$?
@@ -1408,7 +1416,7 @@ _repair_scratch_fs()
# Fall through to repair base fs
dev=$OVL_BASE_SCRATCH_DEV
fstyp=$OVL_BASE_FSTYP
- $UMOUNT_PROG $OVL_BASE_SCRATCH_MNT
+ _unmount $OVL_BASE_SCRATCH_MNT
fi
# Let's hope fsck -y suffices...
fsck -t $fstyp -y $dev 2>&1
@@ -1441,7 +1449,7 @@ _repair_test_fs()
_test_xfs_repair -L >>$tmp.repair 2>&1
echo "log zap returns $?" >> $tmp.repair
else
- umount "$TEST_DEV"
+ _unmount "$TEST_DEV"
fi
_test_xfs_repair "$@" >>$tmp.repair 2>&1
res=$?
@@ -2222,7 +2230,7 @@ _require_logdev()
_notrun "This test requires USE_EXTERNAL to be enabled"
# ensure its not mounted
- $UMOUNT_PROG $SCRATCH_LOGDEV 2>/dev/null
+ _unmount $SCRATCH_LOGDEV 2>/dev/null
}
# This test requires that an external log device is not in use
@@ -3309,7 +3317,7 @@ _umount_or_remount_ro()
local mountpoint=`_is_dev_mounted $device`
if [ $USE_REMOUNT -eq 0 ]; then
- $UMOUNT_PROG $device
+ _unmount $device
else
_remount $device ro
fi
@@ -3826,7 +3834,7 @@ _require_scratch_dev_pool()
_notrun "$i is part of TEST_DEV, this test requires unique disks"
fi
if _mount | grep -q $i; then
- if ! $UMOUNT_PROG $i; then
+ if ! _unmount $i; then
echo "failed to unmount $i - aborting"
exit 1
fi
@@ -44,7 +44,7 @@ _crashtest()
_filter_xfs_io
$here/src/godown -f $mnt
- $UMOUNT_PROG $mnt
+ _unmount $mnt
_mount $img $mnt
# We should /never/ see 0xCD in the file, because we wrote that pattern
@@ -54,7 +54,7 @@ _crashtest()
_hexdump $file
fi
- $UMOUNT_PROG $mnt
+ _unmount $mnt
}
# Modify as appropriate.
@@ -87,8 +87,9 @@ blockdev --setro $SCRATCH_DEV
echo "mounting filesystem that needs recovery on a read-only device:"
_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
+# expects an error, so open code the unmount
echo "unmounting read-only filesystem"
-_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
+$UMOUNT_PROG $SCRATCH_DEV 2>&1 | _filter_scratch | _filter_ending_dot
#
# This is the way out if the underlying device really is read-only.
@@ -66,7 +66,7 @@ umount_symlink_device()
rm -f $symlink
echo "# umount symlink to device, which is not mounted" >>$seqres.full
ln -s $SCRATCH_DEV $symlink
- $UMOUNT_PROG $symlink >>$seqres.full 2>&1
+ _unmount $symlink >>$seqres.full 2>&1
}
# umount a path name that is 256 bytes long, this should fail gracefully,
@@ -78,7 +78,7 @@ umount_toolong_name()
_scratch_mount 2>&1 | tee -a $seqres.full
echo "# umount a too-long name" >>$seqres.full
- $UMOUNT_PROG $longname >>$seqres.full 2>&1
+ _unmount $longname >>$seqres.full 2>&1
_scratch_unmount 2>&1 | tee -a $seqres.full
}
@@ -93,7 +93,7 @@ lazy_umount_symlink()
rm -f $symlink
ln -s $SCRATCH_MNT/testdir $symlink
- $UMOUNT_PROG -l $symlink >>$seqres.full 2>&1
+ _unmount -l $symlink >>$seqres.full 2>&1
# _scratch_unmount should not be blocked
_scratch_unmount 2>&1 | tee -a $seqres.full
}
@@ -32,7 +32,7 @@ _cleanup()
# other tests to fail.
while test -e /dev/mapper/$vgname-$snapname || \
test -e /dev/mapper/$vgname-$lvname; do
- $UMOUNT_PROG $mnt >> $seqres.full 2>&1
+ _unmount $mnt >> $seqres.full 2>&1
$LVM_PROG lvremove -f $vgname/$snapname >>$seqres.full 2>&1
$LVM_PROG lvremove -f $vgname/$lvname >>$seqres.full 2>&1
$LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1
@@ -27,7 +27,7 @@ cleanup_dmdev()
$DMSETUP_PROG resume $lvdev >/dev/null 2>&1
[ -n "$pid" ] && kill -9 $pid 2>/dev/null
wait $pid
- $UMOUNT_PROG $lvdev >/dev/null 2>&1
+ _unmount $lvdev >/dev/null 2>&1
_dmsetup_remove $node
}
@@ -69,8 +69,8 @@ for ((i=0; i<100; i++)); do
done &
pid=$!
for ((i=0; i<100; i++)); do
- $MOUNT_PROG $lvdev $SCRATCH_MNT >/dev/null 2>&1
- $UMOUNT_PROG $lvdev >/dev/null 2>&1
+ _mount $lvdev $SCRATCH_MNT >/dev/null 2>&1
+ _unmount $lvdev >/dev/null 2>&1
done &
pid="$pid $!"
@@ -18,7 +18,7 @@ _cleanup()
{
cd /
echo running > /sys/block/`_short_dev $SCSI_DEBUG_DEV`/device/state
- $UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1
+ _unmount $SCRATCH_MNT >>$seqres.full 2>&1
$LVM_PROG vgremove -f $vgname >>$seqres.full 2>&1
$LVM_PROG pvremove -f $SCRATCH_DEV $SCSI_DEBUG_DEV >>$seqres.full 2>&1
$UDEV_SETTLE_PROG
@@ -36,7 +36,7 @@ mkdir $testdir
echo "Reformat with appropriate size"
blksz="$(_get_block_size $testdir)"
nr_blks=10240
-umount $SCRATCH_MNT
+_scratch_unmount
sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
@@ -35,7 +35,7 @@ mkdir $testdir
echo "Reformat with appropriate size"
blksz="$(_get_block_size $testdir)"
-umount $SCRATCH_MNT
+_scratch_unmount
file_size=$((768 * 1024 * 1024))
fs_size=$((1024 * 1024 * 1024))
@@ -36,7 +36,7 @@ mkdir $testdir
echo "Reformat with appropriate size"
blksz="$(_get_block_size $testdir)"
nr_blks=10240
-umount $SCRATCH_MNT
+_scratch_unmount
sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
@@ -37,7 +37,7 @@ mkdir $testdir
echo "Reformat with appropriate size"
blksz="$(_get_block_size $testdir)"
nr_blks=10240
-umount $SCRATCH_MNT
+_scratch_unmount
sz_bytes=$((nr_blks * 8 * blksz))
if [ $sz_bytes -lt $((32 * 1048576)) ]; then
sz_bytes=$((32 * 1048576))
@@ -12,7 +12,7 @@ _begin_fstest auto quick rw
# Override the default cleanup function.
_cleanup()
{
- umount $BINDFILE
+ _unmount $BINDFILE
cd /
rm -f $tmp.*
}
@@ -61,7 +61,7 @@ md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
echo "Check for damage"
-umount $SCRATCH_MNT
+_scratch_unmount
_repair_scratch_fs >> $seqres.full
# success, all done
@@ -16,7 +16,7 @@ _begin_fstest auto quick
# Override the default cleanup function.
_cleanup()
{
- $UMOUNT_PROG $fs_mnt
+ _unmount $fs_mnt
_destroy_loop_device $loop_dev
cd /
rm -f $tmp.*
@@ -60,7 +60,7 @@ md5sum $testdir/file | _filter_scratch
md5sum $othertestdir/otherfile | filter_otherdir
echo "Unmount otherdir"
-$UMOUNT_PROG $otherdir
+_unmount $otherdir
rm -rf $otherdir
# success, all done
@@ -59,7 +59,7 @@ echo "Check output"
md5sum $testdir/file $othertestdir/otherfile | filter_md5
echo "Unmount otherdir"
-$UMOUNT_PROG $otherdir
+_unmount $otherdir
rm -rf $otherdir
# success, all done
@@ -75,7 +75,7 @@ mount --bind $SCRATCH_MNT $SCRATCH_MNT/ro_bind_mnt
mount -o remount,ro,bind $SCRATCH_MNT/ro_bind_mnt
_set_encpolicy $SCRATCH_MNT/ro_bind_mnt/ro_dir |& _filter_scratch
_get_encpolicy $SCRATCH_MNT/ro_bind_mnt/ro_dir |& _filter_scratch
-umount $SCRATCH_MNT/ro_bind_mnt
+_unmount $SCRATCH_MNT/ro_bind_mnt
# success, all done
status=0
@@ -28,7 +28,7 @@ _cleanup()
xfs_freeze -u $SCRATCH_MNT 2>/dev/null
cd /
rm -f $tmp.*
- $UMOUNT_PROG $SCRATCH_MNT >>$seqres.full 2>&1
+ _unmount $SCRATCH_MNT >>$seqres.full 2>&1
$LVM_PROG vgremove -ff $vgname >>$seqres.full 2>&1
$LVM_PROG pvremove -ff $SCRATCH_DEV >>$seqres.full 2>&1
$UDEV_SETTLE_PROG
@@ -16,13 +16,13 @@ _begin_fstest auto quick
# Override the default cleanup function.
_cleanup()
{
+ echo $$ > $cgdir/cgroup.procs
+ rmdir $cgdir/$seq-cg* > /dev/null 2>&1
+ _unmount $SCRATCH_MNT > /dev/null 2>&1
+ _destroy_loop_device $LOOP_DEV > /dev/null 2>&1
cd /
rm -f $tmp.*
- echo $$ > $cgdir/cgroup.procs
- rmdir $cgdir/$seq-cg* > /dev/null 2>&1
- umount $SCRATCH_MNT > /dev/null 2>&1
- _destroy_loop_device $LOOP_DEV > /dev/null 2>&1
}
# Import common functions.
@@ -80,7 +80,7 @@ reset()
rmdir $cgdir/$seq-cg* > /dev/null 2>&1
$XFS_IO_PROG -fc "pwrite 0 $iosize" $SCRATCH_MNT/file \
>> $seqres.full 2>&1
- umount $SCRATCH_MNT || _fail "umount failed"
+ _unmount $SCRATCH_MNT || _fail "umount failed"
_mount $LOOP_DEV $SCRATCH_MNT || _fail "mount failed"
stat $SCRATCH_MNT/file > /dev/null
}
@@ -26,7 +26,7 @@ done
# mount the base fs. Delay the mount attempt by a small amount in the hope
# that the mount() call will try to lock s_umount /after/ umount has already
# taken it.
-$UMOUNT_PROG $SCRATCH_MNT &
+_unmount $SCRATCH_MNT &
sleep 0.01s ; _scratch_mount
wait
@@ -84,7 +84,7 @@ worker() {
touch $mergedir/etc/access.conf
mv $mergedir/etc/access.conf $mergedir/etc/access.conf.bak
touch $mergedir/etc/access.conf
- umount $mergedir
+ _unmount $mergedir
done
rm -f $SCRATCH_MNT/workers/$tag
}
@@ -18,7 +18,7 @@ _cleanup()
{
_kill_fsstress
if [ -n "$loopmnt" ]; then
- $UMOUNT_PROG $loopmnt 2>/dev/null
+ _unmount $loopmnt 2>/dev/null
rm -r -f $loopmnt
fi
_dmerror_unmount
@@ -102,7 +102,7 @@ while _soak_loop_running $((25 * TIME_FACTOR)); do
# Mount again to replay log after loading working table, so we have a
# consistent fs after test.
- $UMOUNT_PROG $loopmnt
+ _unmount $loopmnt
is_unmounted=1
# We must unmount dmerror at here, or whole later testing will crash.
# So try to umount enough times, before we have no choice.
@@ -128,7 +128,7 @@ done
# Make sure the fs image file is ok
if [ -f "$loopimg" ]; then
if _mount $loopimg $loopmnt -o loop; then
- $UMOUNT_PROG $loopmnt &> /dev/null
+ _unmount $loopmnt &> /dev/null
else
_metadump_dev $DMERROR_DEV $seqres.scratch.final.md
echo "final scratch mount failed"
@@ -17,8 +17,8 @@ _begin_fstest auto quick perms attr idmapped mount
_cleanup()
{
cd /
- $UMOUNT_PROG $SCRATCH_MNT/target-mnt 2>/dev/null
- $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+ _unmount $SCRATCH_MNT/target-mnt 2>/dev/null
+ _unmount $SCRATCH_MNT 2>/dev/null
rm -r -f $tmp.*
}
@@ -15,9 +15,9 @@ _begin_fstest auto quick perms attr idmapped mount
_cleanup()
{
cd /
- $UMOUNT_PROG $SCRATCH_MNT/target-mnt
- $UMOUNT_PROG $SCRATCH_MNT/ovl-merge 2>/dev/null
- $UMOUNT_PROG $SCRATCH_MNT 2>/dev/null
+ _unmount $SCRATCH_MNT/target-mnt
+ _unmount $SCRATCH_MNT/ovl-merge 2>/dev/null
+ _unmount $SCRATCH_MNT 2>/dev/null
rm -r -f $tmp.*
}
@@ -113,7 +113,7 @@ setup_overlayfs_idmapped_lower_metacopy_on()
reset_overlayfs()
{
- $UMOUNT_PROG $SCRATCH_MNT/ovl-merge 2>/dev/null
+ _unmount $SCRATCH_MNT/ovl-merge 2>/dev/null
rm -rf $upper $work $merge
}
@@ -14,7 +14,7 @@ _cleanup()
{
cd /
rm -r -f $tmp.*
- [ -d "$SCSI_DEBUG_MNT" ] && $UMOUNT_PROG $SCSI_DEBUG_MNT 2>/dev/null
+ [ -d "$SCSI_DEBUG_MNT" ] && _unmount $SCSI_DEBUG_MNT 2>/dev/null
_put_scsi_debug_dev
}
@@ -85,7 +85,7 @@ mkdir -p $SCRATCH_MNT/xyz
mount --bind $dir $SCRATCH_MNT/xyz --bind
_pwrite_byte 0x60 0 $((blksz * (nrblks + 2))) $dir/c >> $seqres.full
$XFS_IO_PROG -c "exchangerange $SCRATCH_MNT/xyz/c" $dir/a
-umount $SCRATCH_MNT/xyz
+_unmount $SCRATCH_MNT/xyz
echo Swapping a file with itself
$XFS_IO_PROG -c "exchangerange $dir/a" $dir/a
@@ -12,7 +12,7 @@ _begin_fstest auto quick
_cleanup()
{
cd /
- $UMOUNT_PROG $SCSI_DEBUG_MNT >>$seqres.full 2>&1
+ _unmount $SCSI_DEBUG_MNT >>$seqres.full 2>&1
_put_scsi_debug_dev
rm -f $tmp.*
}
@@ -13,7 +13,7 @@ _begin_fstest auto quick
_cleanup()
{
cd /
- $UMOUNT_PROG $SCSI_DEBUG_MNT >>$seqres.full 2>&1
+ _unmount $SCSI_DEBUG_MNT >>$seqres.full 2>&1
_put_scsi_debug_dev
rm -f $tmp.*
}
@@ -15,8 +15,8 @@ _begin_fstest auto quick rename
# Override the default cleanup function.
_cleanup()
{
- $UMOUNT_PROG $testdir1 2>/dev/null
- $UMOUNT_PROG $testdir2 2>/dev/null
+ _unmount $testdir1 2>/dev/null
+ _unmount $testdir2 2>/dev/null
cd /
rm -r -f $tmp.*
}
@@ -13,7 +13,7 @@ _begin_fstest auto quick volume tempfsid
# Override the default cleanup function.
_cleanup()
{
- umount $extra_mnt &> /dev/null
+ _unmount $extra_mnt &> /dev/null
rm -rf $extra_mnt
_unmount_flakey
_cleanup_flakey
@@ -15,8 +15,8 @@ _cleanup()
cd /
rm -r -f $tmp.*
- $UMOUNT_PROG $mnt2 &> /dev/null
- $UMOUNT_PROG $mnt1 &> /dev/null
+ _unmount $mnt2 &> /dev/null
+ _unmount $mnt1 &> /dev/null
[ -b "$loop_dev2" ] && losetup -d $loop_dev2
[ -b "$loop_dev1" ] && losetup -d $loop_dev1
[ -n "$seq" ] && rm -rf $TEST_DIR/$seq
@@ -42,7 +42,7 @@ clone_filesystem()
_mount $dev1 $mnt1
$XFS_IO_PROG -fc 'pwrite -S 0x61 0 9000' $mnt1/foo >> $seqres.full
- $UMOUNT_PROG $mnt1
+ _unmount $mnt1
# device dump of $dev1 to $dev2
dd if=$dev1 of=$dev2 conv=fsync status=none || _fail "dd failed: $?"
@@ -38,7 +38,7 @@ esac
# Override the default cleanup function.
_cleanup()
{
- $UMOUNT_PROG $loop_dev &> /dev/null
+ _unmount $loop_mnt &> /dev/null
_destroy_loop_device $loop_dev
if [ $status -eq 0 ]; then
rm -rf $tmp
@@ -53,7 +53,7 @@ get_holes()
# in-core state that will perturb the free space map on umount. Stick
# to established convention which requires the filesystem to be
# unmounted while we probe the underlying file.
- $UMOUNT_PROG $loop_mnt
+ _unmount $loop_mnt
# FIEMAP only works on regular files, so call it on the backing file
# and not the loop device like everything else
@@ -66,7 +66,7 @@ get_free_sectors()
{
case $FSTYP in
ext4)
- $UMOUNT_PROG $loop_mnt
+ _unmount $loop_mnt
$DUMPE2FS_PROG $loop_dev 2>&1 | grep " Free blocks" | cut -d ":" -f2- | \
tr ',' '\n' | $SED_PROG 's/^ //' | \
$AWK_PROG -v spb=$sectors_per_block 'BEGIN{FS="-"};
@@ -80,7 +80,7 @@ get_free_sectors()
xfs)
agsize=`$XFS_INFO_PROG $loop_mnt | $SED_PROG -n 's/.*agsize=\(.*\) blks.*/\1/p'`
# Convert free space (agno, block, length) to (start sector, end sector)
- $UMOUNT_PROG $loop_mnt
+ _unmount $loop_mnt
$XFS_DB_PROG -r -c "freesp -d" $loop_dev | $SED_PROG '/^.*from/,$d'| \
$AWK_PROG -v spb=$sectors_per_block -v agsize=$agsize \
'{ print spb * ($1 * agsize + $2), spb * ($1 * agsize + $2 + $3) - 1 }'
@@ -22,7 +22,7 @@ _begin_fstest auto enospc quick quota prealloc
_cleanup()
{
cd /
- umount $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
_scratch_unmount 2>/dev/null
rm -f $tmp.*
}
@@ -168,13 +168,13 @@ LOOP_MNT=$SCRATCH_MNT/$seq.mnt
$MKFS_XFS_PROG -d "file=1,name=$LOOP_FILE,size=10g" >> $seqres.full 2>&1
mkdir -p $LOOP_MNT
-mount -t xfs -o loop,uquota,gquota $LOOP_FILE $LOOP_MNT || \
+_mount -o uquota,gquota $LOOP_FILE $LOOP_MNT || \
_fail "Failed to mount loop fs."
_test_enospc $LOOP_MNT
_test_edquot $LOOP_MNT
-umount $LOOP_MNT
+_unmount $LOOP_MNT
echo $orig_sp_time > /proc/sys/fs/xfs/speculative_prealloc_lifetime
@@ -21,9 +21,9 @@ _cleanup()
{
cd /
_scratch_unmount 2>/dev/null
- umount $imgs.loop 2>/dev/null
+ _unmount $imgs.loop 2>/dev/null
+ _unmount $imgs.source_dir 2>/dev/null
[ -d $imgs.loop ] && rmdir $imgs.loop
- umount $imgs.source_dir 2>/dev/null
[ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
}
@@ -65,10 +65,10 @@ _verify_copy()
rmdir $target_dir 2>/dev/null
mkdir $target_dir
- mount -t xfs -o loop $target $target_dir 2>/dev/null
+ _mount -t xfs -o loop $target $target_dir 2>/dev/null
if [ $? -ne 0 ]; then
echo retrying mount with nouuid option >>$seqres.full
- mount -t xfs -o loop -o nouuid $target $target_dir
+ _mount -t xfs -o loop -o nouuid $target $target_dir
if [ $? -ne 0 ]; then
echo mount failed - evil!
return
@@ -87,19 +87,19 @@ _verify_copy()
echo comparing new image geometry to old
$XFS_INFO_PROG $source_dir \
- | _filter_copy $source $source_dir '/dev/loop.' '#' \
+ | _filter_copy $source $source_dir '/dev/loop[0-9]\+' '#' \
| tr -s ' ' \
> $tmp.geometry1
$XFS_INFO_PROG $target_dir \
- | _filter_copy $target $target_dir '/dev/loop.' '#' \
+ | _filter_copy $target $target_dir '/dev/loop[0-9]\+' '#' \
| tr -s ' ' \
> $tmp.geometry2
[ -s $tmp.geometry1 ] || echo no geometry output
diff -u $tmp.geometry1 $tmp.geometry2
echo unmounting and removing new image
- umount $source_dir
- umount $target_dir > /dev/null 2>&1
+ _unmount $source_dir
+ _unmount $target_dir > /dev/null 2>&1
rm -f $target
}
@@ -134,10 +134,10 @@ ${MKFS_XFS_PROG} -dfile,name=$imgs.source,size=100g \
rmdir $imgs.source_dir 2>/dev/null
mkdir $imgs.source_dir
-mount -t xfs -o loop $imgs.source $imgs.source_dir
+_mount -t xfs -o loop $imgs.source $imgs.source_dir
loop2=`mount | grep $imgs.source | grep -o -e 'loop=.*[^),]' | grep -o -e '/.*$'`
cp -a $here $imgs.source_dir
-mount -t xfs -o remount,ro $imgs.source $imgs.source_dir
+_mount -t xfs -o remount,ro $imgs.source $imgs.source_dir
$XFS_COPY_PROG $imgs.source $imgs.image | _filter_copy '#' $imgs.image '#' '#'
_verify_copy $imgs.image $imgs.source $imgs.source_dir
@@ -72,7 +72,7 @@ $XFS_IO_PROG -ft \
-c "falloc 1023m 2g" \
$LOOP_MNT/foo >> $seqres.full
-umount $LOOP_MNT
+_unmount $LOOP_MNT
_check_xfs_filesystem $LOOP_DEV none none
# success, all done
@@ -16,7 +16,7 @@ _cleanup()
{
cd /
rm -f $tmp.*
- $UMOUNT_PROG $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
[ -n "$LOOP_DEV" ] && _destroy_loop_device $LOOP_DEV 2>/dev/null
# try to keep the image file if test fails
[ $status -eq 0 ] && rm -f $LOOP_IMG
@@ -75,13 +75,13 @@ _grow_loop()
$XFS_IO_PROG -c "pwrite $new_size $bsize" $LOOP_IMG | _filter_io
LOOP_DEV=`_create_loop_device $LOOP_IMG`
echo "*** mount loop filesystem"
- $MOUNT_PROG -t xfs $LOOP_DEV $LOOP_MNT
+ _mount -t xfs $LOOP_DEV $LOOP_MNT
echo "*** grow loop filesystem"
$XFS_GROWFS_PROG $LOOP_MNT 2>&1 | _filter_growfs 2>&1
echo "*** unmount"
- $UMOUNT_PROG -d $LOOP_MNT && LOOP_DEV=
+ _unmount $LOOP_MNT
# Large grows takes forever to check..
if [ "$check" -gt "0" ]
@@ -14,7 +14,7 @@ _begin_fstest auto quick fuzzers
_cleanup()
{
cd /
- $UMOUNT_PROG $mntpt > /dev/null 2>&1
+ _unmount $mntpt > /dev/null 2>&1
_destroy_loop_device $loopdev > /dev/null 2>&1
rm -r -f $tmp.*
}
@@ -90,7 +90,7 @@ cat $tmp.log >> $seqres.full
cat $tmp.log | _filter_test_dir
# Corrupt the entries
-$UMOUNT_PROG $mntpt
+_unmount $mntpt
_destroy_loop_device $loopdev
cp $imgfile $imgfile.old
sed -b \
@@ -121,7 +121,7 @@ fi
echo "does repair complain?" >> $seqres.full
# Does repair complain about this?
-$UMOUNT_PROG $mntpt
+_unmount $mntpt
$XFS_REPAIR_PROG -n $loopdev >> $seqres.full 2>&1
res=$?
test $res -eq 1 || \
@@ -22,7 +22,7 @@ loop_symlink=$TEST_DIR/loop_symlink.$$
# Override the default cleanup function.
_cleanup()
{
- $UMOUNT_PROG $mntdir
+ _unmount $mntdir
[ -n "$loop_dev" ] && _destroy_loop_device $loop_dev
rmdir $mntdir
rm -f $loop_symlink
@@ -73,7 +73,7 @@ echo "=== xfs_growfs - check device symlink ==="
$XFS_GROWFS_PROG -D 12288 $loop_symlink > /dev/null
echo "=== unmount ==="
-$UMOUNT_PROG $mntdir || _fail "!!! failed to unmount"
+_unmount $mntdir || _fail "!!! failed to unmount"
echo "=== mount device symlink ==="
$MOUNT_PROG $loop_symlink $mntdir || _fail "!!! failed to loopback mount"
@@ -87,7 +87,7 @@ _do_eas()
_create_eas $2 $3
fi
echo ""
- cd /; $UMOUNT_PROG $SCRATCH_MNT
+ cd /; _unmount $SCRATCH_MNT
_print_inode
}
@@ -99,7 +99,7 @@ _do_dirents()
echo ""
_scratch_mount
_create_dirents $1 $2
- cd /; $UMOUNT_PROG $SCRATCH_MNT
+ cd /; _unmount $SCRATCH_MNT
_print_inode
}
@@ -12,6 +12,12 @@ _begin_fstest log metadata auto quick
# Import common functions.
. ./common/filter
+_cleanup()
+{
+ _unmount $LOOP_MNT > /dev/null 2>&1
+ cd /
+ rm -f $tmp.*
+}
_require_scratch
_scratch_mkfs_xfs >/dev/null 2>&1
@@ -50,9 +56,9 @@ _do_mkfs()
echo -n "fssize=${i}g "
$MKFS_XFS_PROG -f -b size=4096 -l version=2 \
-d name=$LOOP_DEV,size=${i}g $loop_mkfs_opts |grep log
- mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
+ _mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount $LOOP_MNT > /dev/null 2>&1
+ _unmount $LOOP_MNT > /dev/null 2>&1
done
}
# make large holey file
@@ -29,9 +29,9 @@ _do_mkfs()
echo -n "fssize=${i}g "
$MKFS_XFS_PROG -f -b size=4096 -l version=2 \
-d name=$LOOP_DEV,size=${i}g |grep log
- mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
+ _mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount $LOOP_MNT > /dev/null 2>&1
+ _unmount $LOOP_MNT > /dev/null 2>&1
# punch out the previous blocks so that we keep the amount of
# disk space the test requires down to a minimum.
@@ -13,9 +13,10 @@ _begin_fstest auto quick rw prealloc metadata
_cleanup()
{
cd /
- umount $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
rm -f $LOOP_DEV
rmdir $LOOP_MNT
+ rm -f $tmp.*
}
# Import common functions.
@@ -54,13 +55,13 @@ _test_loop()
| _filter_mkfs 2>/dev/null
echo "*** mount loop filesystem"
- mount -t xfs -o loop $LOOP_DEV $LOOP_MNT
+ _mount -t xfs -o loop $LOOP_DEV $LOOP_MNT
echo "*** preallocate large file"
$XFS_IO_PROG -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
echo "*** unmount loop filesystem"
- umount $LOOP_MNT > /dev/null 2>&1
+ _unmount $LOOP_MNT > /dev/null 2>&1
echo "*** check loop filesystem"
_check_xfs_filesystem $LOOP_DEV none none
@@ -13,8 +13,8 @@ _begin_fstest growfs auto quick
# Override the default cleanup function.
_cleanup()
{
- $UMOUNT_PROG $tmpdir
- $UMOUNT_PROG $tmpbind
+ _unmount $tmpdir
+ _unmount $tmpbind
rmdir $tmpdir
rm -f $tmpsymlink
rmdir $tmpbind
@@ -22,7 +22,7 @@ _register_cleanup "_cleanup" BUS
_cleanup()
{
cd /
- test -n "$loop_mount" && $UMOUNT_PROG $loop_mount > /dev/null 2>&1
+ test -n "$loop_mount" && _unmount $loop_mount > /dev/null 2>&1
test -n "$loop_dev" && _destroy_loop_device $loop_dev
rm -rf $tmp.*
}
@@ -14,7 +14,7 @@ _cleanup()
{
cd /
rm -f $tmp.*
- $UMOUNT_PROG $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
if [ -n "$LOOP_DEV" ];then
_destroy_loop_device $LOOP_DEV 2>/dev/null
fi
@@ -89,7 +89,7 @@ get_mount_info()
force_unmount()
{
- $UMOUNT_PROG $LOOP_MNT >/dev/null 2>&1
+ _unmount $LOOP_MNT >/dev/null 2>&1
}
# _do_test <mount options> <should be mounted?> [<key string> <key should be found?>]
@@ -15,7 +15,7 @@ _cleanup()
_cleanup_dump
cd /
rm -r -f $tmp.*
- $UMOUNT_PROG $TEST_DIR/dest.$seq 2> /dev/null
+ _unmount $TEST_DIR/dest.$seq 2> /dev/null
rmdir $TEST_DIR/src.$seq 2> /dev/null
rmdir $TEST_DIR/dest.$seq 2> /dev/null
}
@@ -14,7 +14,7 @@ _begin_fstest auto quick growfs
_cleanup()
{
local dev
- $UMOUNT_PROG $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
dev=$(losetup -j testfile | cut -d: -f1)
losetup -d $dev 2>/dev/null
rm -rf $LOOP_IMG $LOOP_MNT
@@ -14,7 +14,7 @@ _cleanup()
{
cd /
rm -f $tmp.*
- $UMOUNT_PROG $LOOP_MNT 2>/dev/null
+ _unmount $LOOP_MNT 2>/dev/null
if [ -n "$LOOP_DEV" ];then
_destroy_loop_device $LOOP_DEV 2>/dev/null
fi
@@ -90,7 +90,7 @@ get_mount_info()
force_unmount()
{
- $UMOUNT_PROG $LOOP_MNT >/dev/null 2>&1
+ _unmount $LOOP_MNT >/dev/null 2>&1
}
# _do_test <mount options> <should be mounted?> [<key string> <key should be found?>]