All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Zorro Lang <zlang@redhat.com>
Cc: "Darrick J . Wong" <darrick.wong@oracle.com>,
	Dave Chinner <david@fromorbit.com>,
	fstests@vger.kernel.org
Subject: [PATCH 2/4] fstests: make sure to unfreeze test and scratch mounts
Date: Sun, 19 Jun 2022 16:46:55 +0300	[thread overview]
Message-ID: <20220619134657.1846292-3-amir73il@gmail.com> (raw)
In-Reply-To: <20220619134657.1846292-1-amir73il@gmail.com>

Almost all of the tests that _require_freeze() fail to unfreeze
scratch mount in case the test is interrupted while fs is frozen.

Move the handling of unfreeze to generic check code.
For now, tests only freeze scratch fs, but to be more robust, unfreeze
both test and scratch fs following a call to _require_freeze().

Tests could still hang if thier private _cleanup() routine tries
to modify the frozen fs or wait for a blocked process. Fix the
_cleanup() routine of xfs/011 to avoid that.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 check             | 14 ++++++++------
 common/rc         |  5 +++--
 tests/generic/390 |  2 --
 tests/xfs/011     |  2 --
 tests/xfs/517     |  1 -
 5 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/check b/check
index de11b37e..d6ee71aa 100755
--- a/check
+++ b/check
@@ -527,17 +527,21 @@ _check_filesystems()
 {
 	local ret=0
 
+	# Make sure both test and scratch are unfrozen post _require_freeze()
+	if [ -f ${RESULT_DIR}/require_freeze ]; then
+		xfs_freeze -u "$TEST_DIR" >/dev/null 2>&1
+		xfs_freeze -u "$SCRATCH_MNT" >/dev/null 2>&1
+	fi
 	if [ -f ${RESULT_DIR}/require_test ]; then
 		_check_test_fs || ret=1
-		rm -f ${RESULT_DIR}/require_test*
 	else
 		_test_unmount 2> /dev/null
 	fi
 	if [ -f ${RESULT_DIR}/require_scratch ]; then
 		_check_scratch_fs || ret=1
-		rm -f ${RESULT_DIR}/require_scratch*
 	fi
 	_scratch_unmount 2> /dev/null
+	rm -f ${RESULT_DIR}/require_*
 	return $ret
 }
 
@@ -783,8 +787,7 @@ function run_section()
 		seqres="$REPORT_DIR/$seqnum"
 
 		mkdir -p $RESULT_DIR
-		rm -f ${RESULT_DIR}/require_scratch*
-		rm -f ${RESULT_DIR}/require_test*
+		rm -f ${RESULT_DIR}/require_*
 		echo -n "$seqnum"
 
 		if $showme; then
@@ -882,8 +885,7 @@ function run_section()
 			_dump_err_cont "[failed, exit status $sts]"
 			_test_unmount 2> /dev/null
 			_scratch_unmount 2> /dev/null
-			rm -f ${RESULT_DIR}/require_test*
-			rm -f ${RESULT_DIR}/require_scratch*
+			rm -f ${RESULT_DIR}/require_*
 			err=true
 		else
 			# The test apparently passed, so check for corruption
diff --git a/common/rc b/common/rc
index 3c072c16..b87dfe05 100644
--- a/common/rc
+++ b/common/rc
@@ -1540,8 +1540,7 @@ _notrun()
 {
     echo "$*" > $seqres.notrun
     echo "$seq not run: $*"
-    rm -f ${RESULT_DIR}/require_test*
-    rm -f ${RESULT_DIR}/require_scratch*
+    rm -f ${RESULT_DIR}/require_*
 
     status=0
     exit
@@ -3648,6 +3647,8 @@ _require_freeze()
 	local result=$?
 	xfs_freeze -u "$TEST_DIR" >/dev/null 2>&1
 	[ $result -eq 0 ] || _notrun "$FSTYP does not support freezing"
+	# Make sure both test and scratch are unfrozen at the end of the test
+	touch ${RESULT_DIR}/require_freeze
 }
 
 # Does NFS export work on this fs?
diff --git a/tests/generic/390 b/tests/generic/390
index 20c66e22..0f2b86fa 100755
--- a/tests/generic/390
+++ b/tests/generic/390
@@ -14,8 +14,6 @@ _begin_fstest auto freeze stress
 _cleanup()
 {
 	cd /
-	# Make sure $SCRATCH_MNT is unfreezed
-	xfs_freeze -u $SCRATCH_MNT 2>/dev/null
 	rm -f $tmp.*
 }
 
diff --git a/tests/xfs/011 b/tests/xfs/011
index d6e9099e..351a574e 100755
--- a/tests/xfs/011
+++ b/tests/xfs/011
@@ -17,9 +17,7 @@ _begin_fstest auto freeze log metadata quick
 _cleanup()
 {
 	$KILLALL_PROG -9 fsstress 2>/dev/null
-	wait
 	cd /
-	_scratch_unmount 2>/dev/null
 	rm -f $tmp.*
 }
 
diff --git a/tests/xfs/517 b/tests/xfs/517
index f7f9a8a2..961668e3 100755
--- a/tests/xfs/517
+++ b/tests/xfs/517
@@ -15,7 +15,6 @@ _register_cleanup "_cleanup" BUS
 _cleanup()
 {
 	cd /
-	$XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT > /dev/null 2>&1
 	rm -rf $tmp.*
 }
 
-- 
2.25.1


  parent reply	other threads:[~2022-06-19 13:47 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19 13:46 [PATCH 0/4] aborted fstests may leave frozen fs behind Amir Goldstein
2022-06-19 13:46 ` [PATCH 1/4] fstests: add missing _require_freeze() to tests Amir Goldstein
2022-06-23 18:00   ` Darrick J. Wong
2022-06-24  4:05     ` Amir Goldstein
2022-06-24  6:27       ` Zorro Lang
2022-06-19 13:46 ` Amir Goldstein [this message]
2022-06-20 11:17   ` [PATCH 2/4] fstests: make sure to unfreeze test and scratch mounts Zorro Lang
2022-06-20 12:13     ` Amir Goldstein
2022-06-20 14:21       ` Zorro Lang
2022-06-20 15:08         ` Amir Goldstein
2022-06-20 22:34         ` Dave Chinner
2022-06-21  2:53           ` Amir Goldstein
2022-06-20 22:06   ` Dave Chinner
2022-06-21  2:57     ` Amir Goldstein
2022-06-19 13:46 ` [PATCH 3/4] xfs/{422,517}: add missing killall to _cleanup() Amir Goldstein
2022-06-21  4:02   ` Amir Goldstein
2022-06-23 18:04     ` Darrick J. Wong
2022-06-24  4:36       ` Amir Goldstein
2022-06-24  6:31         ` Zorro Lang
2022-06-24  6:41           ` Amir Goldstein
2022-06-24 15:09             ` Zorro Lang
2022-06-24  4:49       ` Delegating fstests maintenance work (Was: Re: [PATCH 3/4] xfs/{422,517}: add missing killall to _cleanup()) Amir Goldstein
2022-06-25  3:11         ` Darrick J. Wong
2022-06-19 13:46 ` [PATCH 4/4] xfs/{422,517}: fix false positive failure Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220619134657.1846292-3-amir73il@gmail.com \
    --to=amir73il@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=fstests@vger.kernel.org \
    --cc=zlang@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.