@@ -331,10 +331,30 @@ _scratch_unmount()
_scratch_remount()
{
+ if [ "$FSTYP" = tmpfs ]; then
+ return
+ fi
_scratch_unmount
_scratch_mount
}
+_scratch_change_mount_opts()
+{
+ case $FSTYP in
+ tmpfs)
+ OPTS="$@"
+ if test -n "$OPTS"; then
+ OPTS=$(echo $OPTS | sed -e 's/-o /-o remount,/')
+ mount $OPTS $SCRATCH_MNT
+ fi
+ ;;
+ *)
+ _scratch_unmount
+ _scratch_mount "$@"
+ ;;
+ esac
+}
+
_test_mount()
{
if [ "$FSTYP" == "overlay" ]; then
@@ -356,6 +376,9 @@ _test_unmount()
_test_remount()
{
+ if [ "$FSTYP" = tmpfs ]; then
+ return
+ fi
_test_unmount
_test_mount
}
@@ -108,8 +108,7 @@ _compare_stat_times NNN "$file1_stat_after_first_access" \
"$file1_stat_after_second_access" "after accessing file1 second time"
# Remounting with nodiratime option
-_scratch_unmount
-_scratch_mount "-o nodiratime"
+_scratch_change_mount_opts "-o nodiratime"
file1_stat_after_remount=`_stat $TPATH/dir1/file1`
_compare_stat_times NNN "$file1_stat_after_second_access" \
"$file1_stat_after_remount" "for file1 after remount"
@@ -135,8 +134,7 @@ _compare_stat_times NNN "$dir2_stat_after_file_creation" \
"$dir2_stat_after_file_access" "for dir2 after file access"
# Remounting with noatime option, creating a file and accessing it
-_scratch_unmount
-_scratch_mount "-o noatime"
+_scratch_change_mount_opts "-o noatime"
echo "ccc" > $TPATH/dir2/file3
file3_stat_before_first_access=`_stat $TPATH/dir2/file3`
sleep 1
@@ -160,8 +158,7 @@ _compare_stat_times NNY "$file1_stat_after_modify" \
# Remounting with strictatime option and
# accessing a previously created file twice
-_scratch_unmount
-_scratch_mount "-o strictatime"
+_scratch_change_mount_opts "-o strictatime"
cat $TPATH/dir2/file3 > /dev/null
file3_stat_after_second_access=`_stat $TPATH/dir2/file3`
_compare_stat_times YNN "$file3_stat_after_first_access" \
@@ -194,8 +191,7 @@ fi
sleep 1
dir2_stat_before_ro_mount=`_stat $TPATH/dir2`
file3_stat_before_ro_mount=`_stat $TPATH/dir2/file3`
-_scratch_unmount
-_scratch_mount "-o ro,strictatime"
+_scratch_change_mount_opts "-o ro,strictatime"
ls $TPATH/dir2 > /dev/null
cat $TPATH/dir2/file3 > /dev/null
dir2_stat_after_ro_mount=`_stat $TPATH/dir2`
@@ -41,19 +41,8 @@ _supported_os Linux IRIX
_require_odirect
_require_scratch
-_scratch_mkfs >/dev/null 2>&1
-
-_umount_mount()
-{
- CWD=`pwd`
- cd /
- # pipe error into /dev/null, in case not mounted (after _require_scratch)
- _scratch_unmount 2>/dev/null
- _scratch_mount
- cd "$CWD"
-}
-
-_umount_mount
+_scratch_mkfs >/dev/null
+_scratch_mount
cd $SCRATCH_MNT
@@ -71,7 +60,7 @@ $XFS_IO_PROG -f -c 'pwrite -b 4k -S 0x78 0 4k' trunc_file > /dev/null
$XFS_IO_PROG -f -c 'truncate 2k' trunc_file > /dev/null
$XFS_IO_PROG -c 'pwrite 1k 0 1k' trunc_file > /dev/null
-_umount_mount
+_scratch_remount
# check file size and contents
od -Ad -x async_file
@@ -73,13 +73,9 @@ $XFS_IO_PROG -a -c "pwrite 0 5k" -c "fsync" \
$SCRATCH_MNT/testfile \
| _show_wrote_and_stat_only
-echo "# unmounting scratch"
-_scratch_unmount>>$seqres.full 2>&1 \
- || _fail "unmount failed"
-
-echo "# mounting scratch"
-_scratch_mount >>$seqres.full 2>&1 \
- || _fail "mount failed: $MOUNT_OPTIONS"
+echo "# remounting scratch"
+_scratch_remount >>$seqres.full 2>&1 \
+ || _fail "remount failed: $MOUNT_OPTIONS"
echo "# stating file to confirm correct size"
$XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/testfile \
@@ -90,13 +86,9 @@ $XFS_IO_PROG -f -c "pwrite 0 5" -c s -c "pwrite 5 5" \
-c "stat" $SCRATCH_MNT/nextfile \
| _show_wrote_and_stat_only
-echo "# unmounting scratch"
-_scratch_unmount>>$seqres.full 2>&1 \
- || _fail "unmount failed"
-
-echo "# mounting scratch"
-_scratch_mount >>$seqres.full 2>&1 \
- || _fail "mount failed: $MOUNT_OPTIONS"
+echo "# remounting scratch"
+_scratch_remount >>$seqres.full 2>&1 \
+ || _fail "remount failed: $MOUNT_OPTIONS"
echo "# stating file to confirm correct size"
$XFS_IO_PROG -r -c "stat" $SCRATCH_MNT/nextfile \
@@ -5,15 +5,13 @@ wrote 5120/5120 bytes at offset 0
wrote 5120/5120 bytes at offset 5120
wrote 5120/5120 bytes at offset 10240
stat.size = 15360
-# unmounting scratch
-# mounting scratch
+# remounting scratch
# stating file to confirm correct size
stat.size = 15360
# appending 10 bytes to new file, sync at 5 bytes
wrote 5/5 bytes at offset 0
wrote 5/5 bytes at offset 5
stat.size = 10
-# unmounting scratch
-# mounting scratch
+# remounting scratch
# stating file to confirm correct size
stat.size = 10
@@ -78,8 +78,7 @@ cat $testfile
time2=`_access_time $testfile | tee -a $seqres.full`
cd /
-_test_unmount
-_test_mount
+_test_remount
time3=`_access_time $testfile | tee -a $seqres.full`
delta1=`expr $time2 - $time1`
@@ -61,8 +61,7 @@ for I in `seq 1 $loops`; do
done
echo
-_scratch_unmount
-_scratch_mount
+_scratch_remount
echo "--> $loops direct 64m writes in a loop"
for I in `seq 1 $loops`; do
@@ -62,8 +62,7 @@ fi
# unmount, remount, and check the timestamp
echo "Remounting to flush cache"
-_test_unmount
-_test_mount
+_test_remount
# Should yield -315593940 (prior to epoch)
echo "Testing for negative seconds since epoch"
@@ -67,8 +67,7 @@ touch $BINDFILE || _fail "Could not create bind mount file"
touch $TARGET || _fail "Could not create symlink target"
ln -s $TARGET $SYMLINK
-_scratch_unmount || _fail "Could not unmount scratch device"
-_scratch_mount -o ro || _fail "Could not mount scratch readonly"
+_scratch_change_mount_opts -o ro || _fail "Could not remount scratch readonly"
# We should be able to read & write to/from these devices even on an RO fs
echo "== try to create new file"
@@ -96,8 +96,7 @@ echo ""
echo "*** Remounting ***"
echo ""
sync
-_scratch_unmount >>$seqres.full 2>&1
-_scratch_mount >>$seqres.full 2>&1 || _fail "mount failed"
+_scratch_remount >>$seqres.full 2>&1 || _fail "remount failed"
_print_numeric_uid
@@ -109,8 +109,7 @@ _print_getfacls
echo "*** Remounting ***"
echo ""
sync
-_scratch_unmount >>$seqres.full 2>&1
-_scratch_mount >>$seqres.full 2>&1 || _fail "mount failed"
+_scratch_remount >>$seqres.full 2>&1 || _fail "remount failed"
_print_getfacls