Skip to contentSkip to conversation

ext4 freeze regression test

PATCH In review Amir Goldstein 3 participants 9 messages May 14, 2018 – May 17, 2018

lore
Share & tools
lore
#0 lore raw

cover ext4 freeze regression test

Eryu,

This is a regression test for a fix waiting in Ted's dev branch preceded by two minor cleanups.

FYI, at the moment, all _require_freeze tests fail with lockdep enabled because of DEBUG_RWSEMS:
https://marc.info/?l=linux-fsdevel&m=152622016219975&w=2

Thanks,
Amir.

Amir Goldstein (3):
generic/459: use xfs_freeze instead of fsfreeze
fstests: define and use TIMEOUT_PROG
generic: test first read with freeze right after mount

 common/config         |  1 +
 tests/generic/297     |  4 +--
 tests/generic/298     |  4 +--
 tests/generic/459     |  6 ++---
 tests/generic/488     | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/488.out |  2 ++
 tests/generic/group   |  1 +
 7 files changed, 86 insertions(+), 7 deletions(-)
 create mode 100755 tests/generic/488
 create mode 100644 tests/generic/488.out
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/3 generic/459: use xfs_freeze instead of fsfreeze

This is what all other tests use as well as _require_freeze

---
 tests/generic/459 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/generic/459 +3 -3
index e755cf7..22b8e62 100755
@@ -113,7 +113,7 @@ $XFS_IO_PROG -f -d -c 'pwrite -b 1m 0 120m' $SCRATCH_MNT/f1 >>$seqres.full 2>&1
 # extended. It is expected, and is only used so xfsaild is triggered to
 # flush AIL items, other filesystems usually get remounted as read-only during
 # the above write process.
-fsfreeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
+xfs_freeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
 freezeid=$!
 
 # Wait enough so xfsaild can run
@@ -132,7 +132,7 @@ ret=$?
 #	- The filesystem stays in Read-Write mode, but can be frozen/thawed
 #	  without getting stuck.
 if [ $ret -ne 0 ]; then
-	# fsfreeze failed, filesystem should reject further writes and remount
+	# freeze failed, filesystem should reject further writes and remount
 	# as readonly. Sometimes the previous write process won't trigger
 	# ro-remount, e.g. on ext3/4, do additional touch here to make sure
 	# filesystems see the metadata I/O error.
@@ -148,7 +148,7 @@ if [ $ret -ne 0 ]; then
 else
 	# Try to thaw the filesystem, and complete test if if succeed.
 	# NOTE: This will hang on affected XFS filesystems.
-	fsfreeze -u $SCRATCH_MNT >>$seqres.full 2>&1
+	xfs_freeze -u $SCRATCH_MNT >>$seqres.full 2>&1
 	echo "Test OK"
 fi
 
Signature · 1 line
2.7.4
#7 lore raw

PATCH 2/3 fstests: define and use TIMEOUT_PROG

In reply to Amir Goldstein
---
 common/config     | 1 +
 tests/generic/297 | 4 ++--
 tests/generic/298 | 4 ++--
 3 files changed, 5 insertions(+), 4 deletions(-)
common/config +1 -0
index cc31806..af360ce 100644
@@ -204,6 +204,7 @@ export UBIUPDATEVOL_PROG="`set_prog_path ubiupdatevol`"
 export THIN_CHECK_PROG="$(set_prog_path thin_check)"
 export PYTHON2_PROG="`set_prog_path python2`"
 export SQLITE3_PROG="`set_prog_path sqlite3`"
+export TIMEOUT_PROG="`set_prog_path timeout`"
 
 # use 'udevadm settle' or 'udevsettle' to wait for lv to be settled.
 # newer systems have udevadm command but older systems like RHEL5 don't.
tests/generic/297 +2 -2
index f7eb37b..a3ba5c4 100755
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_command "$(which timeout)" "timeout"
+_require_command "$TIMEOUT_PROG" "timeout"
 
 test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
 
@@ -83,7 +83,7 @@ kill_after=2	# give us a shorter time to die
 n=$(stat -c '%s' $testdir/file1)
 echo "performing kill test on $n bytes..." >> $seqres.full
 touch $TEST_DIR/before
-timeout -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
+$TIMEOUT_PROG -s INT ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1
 touch $TEST_DIR/after
 before=$(stat -c '%Y' $TEST_DIR/before)
 after=$(stat -c '%Y' $TEST_DIR/after)
tests/generic/298 +2 -2
index b518da1..a4d458c 100755
@@ -45,7 +45,7 @@ _cleanup()
 _supported_os Linux
 _require_scratch_reflink
 _require_cp_reflink
-_require_command "$(which timeout)" "timeout"
+_require_command "$TIMEOUT_PROG" "timeout"
 
 test $FSTYP == "nfs"  && _notrun "NFS can't interrupt clone operations"
 
@@ -83,7 +83,7 @@ kill_after=2	# give us a shorter time to die
 n=$(stat -c '%s' $testdir/file1)
 echo "performing kill test on $n bytes..." >> $seqres.full
 touch $TEST_DIR/before
-urk=$(timeout -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
+urk=$($TIMEOUT_PROG -s KILL ${kill_after}s $XFS_IO_PROG -f -c "reflink $testdir/file1 0 $n $n" $testdir/file1 >> $seqres.full 2>&1)
 touch $TEST_DIR/after
 before=$(stat -c '%Y' $TEST_DIR/before)
 after=$(stat -c '%Y' $TEST_DIR/after)
Signature · 1 line
2.7.4
#8 lore raw

PATCH 3/3 generic: test first read with freeze right after mount

In reply to Amir Goldstein

With ext4, this leads to freeze proection bypass WARN_ON in ext4_journal_check_start.

---
 tests/generic/488     | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/generic/488.out |  2 ++
 tests/generic/group   |  1 +
 3 files changed, 78 insertions(+)
 create mode 100755 tests/generic/488
 create mode 100644 tests/generic/488.out
tests/generic/488 new file +75 -0
new file mode 100755
index 0000000..02cf489
@@ -0,0 +1,75 @@
+#! /bin/bash
+# FS QA Test No. 488
+#
+# Test first read with freeze right after mount.
+#
+# With ext4, this leads to freeze proection bypass WARN_ON in
+# ext4_journal_check_start.
+#
+#-----------------------------------------------------------------------
+# Copyright (C) 2018 CTERA Networks. All Rights Reserved.
+# Author: Amir Goldstein <[email protected]>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# real QA test starts here
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_freeze
+_require_command "$TIMEOUT_PROG" "timeout"
+
+rm -f $seqres.full
+
+testfile=$SCRATCH_MNT/foo
+
+# Create a filesystem with a file
+_scratch_mkfs >>$seqres.full 2>&1
+_scratch_mount
+echo "frozen" > $testfile
+
+# Mount filesystem "noatime" and freeze right after mount -
+# reads should not block
+_scratch_cycle_mount "noatime"
+xfs_freeze -f $SCRATCH_MNT
+
+# Read file while filesystem is frozen should succeed
+# without blocking
+$TIMEOUT_PROG -s KILL 1s cat $testfile
+
+xfs_freeze -u $SCRATCH_MNT
+
+status=0
+exit
tests/generic/488.out new file +2 -0
new file mode 100644
index 0000000..0907d7c
@@ -0,0 +1,2 @@
+QA output created by 488
+frozen
tests/generic/group +1 -0
index dc637c9..ec993f7 100644
@@ -490,3 +490,4 @@
 485 auto quick insert
 486 auto quick attr
 487 auto quick
+488 auto quick freeze mount
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/3] generic/459: use xfs_freeze instead of fsfreeze

In reply to Amir Goldstein
Quoted 30 lines · Amir Goldstein

This is what all other tests use as well as _require_freeze

---
 tests/generic/459 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/generic/459 +2 -2
index e755cf7..22b8e62 100755
@@ -113,7 +113,7 @@ $XFS_IO_PROG -f -d -c 'pwrite -b 1m 0 120m' $SCRATCH_MNT/f1 >>$seqres.full 2>&1
 # extended. It is expected, and is only used so xfsaild is triggered to
 # flush AIL items, other filesystems usually get remounted as read-only during
 # the above write process.
-fsfreeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
+xfs_freeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
 freezeid=$!
 
 # Wait enough so xfsaild can run
@@ -132,7 +132,7 @@ ret=$?
 #	- The filesystem stays in Read-Write mode, but can be frozen/thawed
 #	  without getting stuck.
 if [ $ret -ne 0 ]; then
-	# fsfreeze failed, filesystem should reject further writes and remount
+	# freeze failed, filesystem should reject further writes and remount
 	# as readonly. Sometimes the previous write process won't trigger
 	# ro-remount, e.g. on ext3/4, do additional touch here to make sure
 	# filesystems see the metadata I/O error.

tests/generic/459 if [ $ret -ne 0 ]; then · line 153

Quoted 7 lines
tests/generic/459 +1 -1
@@ -148,7 +148,7 @@ if [ $ret -ne 0 ]; then
 else
 	# Try to thaw the filesystem, and complete test if if succeed.
 	# NOTE: This will hang on affected XFS filesystems.
-	fsfreeze -u $SCRATCH_MNT >>$seqres.full 2>&1
+	xfs_freeze -u $SCRATCH_MNT >>$seqres.full 2>&1
 	echo "Test OK"
 fi

Shouldn't these all be converted to XFS_FREEZE_PROG w/ a setup call to export XFS_FREEZE_PROG="set_prog_path xfs_freeze"?

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw

Re: [PATCH 1/3] generic/459: use xfs_freeze instead of fsfreeze

Quoted 33 lines · Dave Chinner
Quoted 32 lines · Amir Goldstein

This is what all other tests use as well as _require_freeze

---
 tests/generic/459 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/generic/459 +2 -2
index e755cf7..22b8e62 100755
@@ -113,7 +113,7 @@ $XFS_IO_PROG -f -d -c 'pwrite -b 1m 0 120m' $SCRATCH_MNT/f1 >>$seqres.full 2>&1
 # extended. It is expected, and is only used so xfsaild is triggered to
 # flush AIL items, other filesystems usually get remounted as read-only during
 # the above write process.
-fsfreeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
+xfs_freeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
 freezeid=$!
 
 # Wait enough so xfsaild can run
@@ -132,7 +132,7 @@ ret=$?
 #    - The filesystem stays in Read-Write mode, but can be frozen/thawed
 #      without getting stuck.
 if [ $ret -ne 0 ]; then
-     # fsfreeze failed, filesystem should reject further writes and remount
+     # freeze failed, filesystem should reject further writes and remount
      # as readonly. Sometimes the previous write process won't trigger
      # ro-remount, e.g. on ext3/4, do additional touch here to make sure
      # filesystems see the metadata I/O error.
@@ -148,7 +148,7 @@ if [ $ret -ne 0 ]; then
 else
      # Try to thaw the filesystem, and complete test if if succeed.
Quoted 9 lines

tests/generic/459 if [ $ret -ne 0 ]; then · line 153

Quoted 5 lines
tests/generic/459 +1 -1
      # NOTE: This will hang on affected XFS filesystems.
-     fsfreeze -u $SCRATCH_MNT >>$seqres.full 2>&1
+     xfs_freeze -u $SCRATCH_MNT >>$seqres.full 2>&1
      echo "Test OK"
 fi

Shouldn't these all be converted to XFS_FREEZE_PROG w/ a setup call to export XFS_FREEZE_PROG="set_prog_path xfs_freeze"?

Yeh, I suppose I can take this one as part of the "freeze" cleanup.

Thanks,
Amir.

#4 lore raw

Re: [PATCH 1/3] generic/459: use xfs_freeze instead of fsfreeze

Quoted 6 lines · Amir Goldstein
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Amir Goldstein

This is what all other tests use as well as _require_freeze

---

[...]

Quoted 7 lines
Quoted 4 lines

Shouldn't these all be converted to XFS_FREEZE_PROG w/ a setup call to export XFS_FREEZE_PROG="set_prog_path xfs_freeze"?

Yeh, I suppose I can take this one as part of the "freeze" cleanup.

I looked again and xfs_freeze pattern repeats itself quite often with other xfs_* progs, so I guess I'll leave that cleanup for another time...

Thanks,
Amir.

$ git grep -v '^[[:space:]]*[#;]' tests/*/???| grep -v echo > all
$ (cd /usr/sbin; ls xfs_*) > xfsprogs
$ for p in `cat xfsprogs`; do echo $p; grep -w $p all | wc -l; done
xfs_admin
1
xfs_bmap
24
xfs_copy
9
xfs_db
35
xfs_estimate
0
xfs_freeze
17
xfs_fsr
15
xfs_growfs
3
xfs_info
31
xfs_io
17
xfs_logprint
0
xfs_mdrestore
7
xfs_metadump
1
xfs_mkfile
1
xfs_ncheck
0
xfs_quota
43
xfs_rtcp
0
xfs_spaceman
0
#5 lore raw

Re: [PATCH 1/3] generic/459: use xfs_freeze instead of fsfreeze

Quoted 13 lines · Amir Goldstein
Quoted 6 lines · Amir Goldstein
Quoted 5 lines · Dave Chinner
Quoted 4 lines · Amir Goldstein

This is what all other tests use as well as _require_freeze

---

[...]

Quoted 5 lines
Quoted 4 lines

Shouldn't these all be converted to XFS_FREEZE_PROG w/ a setup call to export XFS_FREEZE_PROG="set_prog_path xfs_freeze"?

Quoted 5 lines
Quoted 2 lines

Yeh, I suppose I can take this one as part of the "freeze" cleanup.

I looked again and xfs_freeze pattern repeats itself quite often with other xfs_* progs, so I guess I'll leave that cleanup for another time...

No worries, just add it to the pile...

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#6 lore raw

Re: [PATCH 1/3] generic/459: use xfs_freeze instead of fsfreeze

In reply to Amir Goldstein
Quoted 3 lines · Amir Goldstein

This is what all other tests use as well as _require_freeze

I'll drop this patch for now per discussion but take the other two patches, the XFS_FREEZE_PROG conversion is not urgent and could wait I think :)

Thanks,
Eryu

Quoted 38 lines
---
 tests/generic/459 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tests/generic/459 +3 -3
index e755cf7..22b8e62 100755
@@ -113,7 +113,7 @@ $XFS_IO_PROG -f -d -c 'pwrite -b 1m 0 120m' $SCRATCH_MNT/f1 >>$seqres.full 2>&1
 # extended. It is expected, and is only used so xfsaild is triggered to
 # flush AIL items, other filesystems usually get remounted as read-only during
 # the above write process.
-fsfreeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
+xfs_freeze -f $SCRATCH_MNT >>$seqres.full 2>&1 &
 freezeid=$!
 
 # Wait enough so xfsaild can run
@@ -132,7 +132,7 @@ ret=$?
 #	- The filesystem stays in Read-Write mode, but can be frozen/thawed
 #	  without getting stuck.
 if [ $ret -ne 0 ]; then
-	# fsfreeze failed, filesystem should reject further writes and remount
+	# freeze failed, filesystem should reject further writes and remount
 	# as readonly. Sometimes the previous write process won't trigger
 	# ro-remount, e.g. on ext3/4, do additional touch here to make sure
 	# filesystems see the metadata I/O error.
@@ -148,7 +148,7 @@ if [ $ret -ne 0 ]; then
 else
 	# Try to thaw the filesystem, and complete test if if succeed.
 	# NOTE: This will hang on affected XFS filesystems.
-	fsfreeze -u $SCRATCH_MNT >>$seqres.full 2>&1
+	xfs_freeze -u $SCRATCH_MNT >>$seqres.full 2>&1
 	echo "Test OK"
 fi
 
Signature · 1 line
2.7.4