All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org, zlang@redhat.com
Cc: guan@eryu.me, fstests@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH 1/3] generic/615: fix loop termination failures
Date: Wed, 13 Dec 2023 14:34:33 -0800	[thread overview]
Message-ID: <170250687380.1363584.4078567385149829394.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <170250686802.1363584.16475360795139585624.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

On 6.7-rc2, I've noticed that this test hangs unpredictably because the
stat loop fails to exit.  While the kill $loop_pid command /should/ take
care of it, it clearly isn't.

Set up an additional safety factor by checking for the existence of a
sentinel flag before starting the loop body.  In bash, "[" is a builtin
so the loop should run almost as tightly as it did before.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/615 |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


diff --git a/tests/generic/615 b/tests/generic/615
index 4979306d56..9411229874 100755
--- a/tests/generic/615
+++ b/tests/generic/615
@@ -21,11 +21,10 @@ _require_odirect
 
 stat_loop()
 {
-	trap "wait; exit" SIGTERM
 	local filepath=$1
 	local blocks
 
-	while :; do
+	while [ -e "$loop_file" ]; do
 		blocks=$(stat -c %b $filepath)
 		if [ $blocks -eq 0 ]; then
 		    echo "error: stat(2) reported zero blocks"
@@ -39,6 +38,8 @@ _scratch_mount
 
 $XFS_IO_PROG -f -s -c "pwrite -b 64K 0 64K" $SCRATCH_MNT/foo > /dev/null
 
+loop_file=$tmp.loopfile
+touch $loop_file
 stat_loop $SCRATCH_MNT/foo &
 loop_pid=$!
 
@@ -64,6 +65,7 @@ for ((i = 0; i < 2000; i++)); do
 	$XFS_IO_PROG -d -c "pwrite -b 64K 0 64K" $SCRATCH_MNT/foo > /dev/null
 done
 
+rm -f $loop_file
 kill $loop_pid &> /dev/null
 wait
 


  reply	other threads:[~2023-12-13 22:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 22:34 [PATCHSET 0/3] fstests: random fixes for v2023.12.10 Darrick J. Wong
2023-12-13 22:34 ` Darrick J. Wong [this message]
2023-12-14  4:44   ` [PATCH 1/3] generic/615: fix loop termination failures Christoph Hellwig
2023-12-13 22:34 ` [PATCH 2/3] generic/410: don't blow away seqres.full during test Darrick J. Wong
2023-12-14  4:44   ` Christoph Hellwig
2023-12-13 22:34 ` [PATCH 3/3] generic/735: skip this test if we cannot finsert at pos 1M Darrick J. Wong
2023-12-14  4:45   ` Christoph Hellwig
2023-12-15  4:44 ` [PATCHSET 0/3] fstests: random fixes for v2023.12.10 Zorro Lang

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=170250687380.1363584.4078567385149829394.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=guan@eryu.me \
    --cc=linux-xfs@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.