Linux-BTRFS Archive on
 help / color / Atom feed
* [PATCH] btrfs/079: fix failure to umount scratch fs due to running filefrag process
@ 2019-09-10 14:26 fdmanana
  0 siblings, 0 replies; only message in thread
From: fdmanana @ 2019-09-10 14:26 UTC (permalink / raw)
  To: fstests; +Cc: linux-btrfs, Filipe Manana

From: Filipe Manana <>

The test fails sporadically when trying to unmount the scratch filesystem
because a filefrag process is still running against a file that exists on
the scrach filesystem. This is because killing the subshell running the
fiemap_work() function does not wait for any filefrag process to complete
first. We need to set a trap for the SIGTERM signal on the subshell so
that it waits for any filefrag process before exitting.

The failure resulted in error messages like the following:

  btrfs/079 57s ... umount: /home/fdmanana/btrfs-tests/scratch_1: target is busy
          (In some cases useful info about processes that
           use the device is found by lsof(8) or fuser(1).)
  _check_btrfs_filesystem: filesystem on /dev/sdc is inconsistent
  (see /home/fdmanana/git/hub/xfstests/results//btrfs/079.full for details)

Fix this by adding a trap for SIGTERM.

Signed-off-by: Filipe Manana <>
 tests/btrfs/079 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/btrfs/079 b/tests/btrfs/079
index e848a261..1e9411be 100755
--- a/tests/btrfs/079
+++ b/tests/btrfs/079
@@ -77,6 +77,12 @@ _filter_error() {
 fiemap_work() {
+	# Wait for any running 'filefrag' subcommand before exitting so that
+	# after the test kills the subshell running this function, it does not
+	# fail with EBUSY when unmounting the scratch device because the filefrag
+	# subcommand is still running with an open file on the scratch fs.
+	trap "wait; exit" SIGTERM
 	while true; do
 		$FILEFRAG_PROG $filename 2> $tmp.output 1> /dev/null

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-10 14:26 [PATCH] btrfs/079: fix failure to umount scratch fs due to running filefrag process fdmanana

Linux-BTRFS Archive on

Archives are clonable:
	git clone --mirror linux-btrfs/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 linux-btrfs linux-btrfs/ \
	public-inbox-index linux-btrfs

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox