FSTests Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] ext4/021: make sure the fdatasync subprocess exits
@ 2020-02-26  3:22 zhangyi (F)
  2020-03-06  1:32 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: zhangyi (F) @ 2020-02-26  3:22 UTC (permalink / raw)
  To: fstests, guaneryu; +Cc: linux-ext4, yi.zhang

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ext4/021: make sure the fdatasync subprocess exits
  2020-02-26  3:22 [PATCH v2] ext4/021: make sure the fdatasync subprocess exits zhangyi (F)
@ 2020-03-06  1:32 ` Theodore Y. Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Y. Ts'o @ 2020-03-06  1:32 UTC (permalink / raw)
  To: zhangyi (F); +Cc: fstests, guaneryu, linux-ext4

On Wed, Feb 26, 2020 at 11:22:56AM +0800, zhangyi (F) wrote:
> 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>

Looks good, thanks!

Reviewed-by: Theodore Ts'o <tytso@mit.edu>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26  3:22 [PATCH v2] ext4/021: make sure the fdatasync subprocess exits zhangyi (F)
2020-03-06  1:32 ` Theodore Y. Ts'o

FSTests Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/fstests/0 fstests/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 fstests fstests/ https://lore.kernel.org/fstests \
		fstests@vger.kernel.org
	public-inbox-index fstests

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.fstests


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git