fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "zhangyi (F)" <yi.zhang@huawei.com>
To: <fstests@vger.kernel.org>, <guaneryu@gmail.com>
Cc: <linux-ext4@vger.kernel.org>, <yi.zhang@huawei.com>
Subject: [PATCH v2] ext4/021: make sure the fdatasync subprocess exits
Date: Wed, 26 Feb 2020 11:22:56 +0800	[thread overview]
Message-ID: <20200226032256.10978-1-yi.zhang@huawei.com> (raw)

Now we just kill fdatasync_work process and wait nothing after the
test, so a busy unmount failure may appear if the fdatasync syscall
doesn't return in time.

  umount: /tmp/scratch: target is busy.
  mount: /tmp/scratch: /dev/sdb already mounted on /tmp/scratch.
  !!! failed to remount /dev/sdb on /tmp/scratch

This patch wait the xfs_io fdatasync subprocess exit to make sure
_check_scratch_fs success.

Signed-off-by: zhangyi (F) <yi.zhang@huawei.com>
---
 tests/ext4/021 | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/ext4/021 b/tests/ext4/021
index 519737e1..3fc38e89 100755
--- a/tests/ext4/021
+++ b/tests/ext4/021
@@ -80,6 +80,10 @@ _scratch_mount
 
 do_fdatasync_work()
 {
+	# Wait for running subcommand before exitting so that
+	# mountpoint is not busy when we try to unmount it
+	trap "wait; exit" SIGTERM
+
 	while [ 1 ]; do
 		$XFS_IO_PROG -f -c "fdatasync" $SCRATCH_MNT/testfile
 	done
@@ -89,6 +93,7 @@ do_fdatasync_work &
 datasync_work_pid=$!
 sleep 10
 kill $datasync_work_pid >/dev/null 2>&1
+wait
 
 # success, all done
 status=0
-- 
2.17.2


             reply	other threads:[~2020-02-26  3:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26  3:22 zhangyi (F) [this message]
2020-03-06  1:32 ` [PATCH v2] ext4/021: make sure the fdatasync subprocess exits Theodore Y. Ts'o

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=20200226032256.10978-1-yi.zhang@huawei.com \
    --to=yi.zhang@huawei.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).