From: Eryu Guan <eguan@redhat.com>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Cc: fstests@vger.kernel.org, linux-btrfs@vger.kernel.org,
chandan@mykolab.com
Subject: Re: [RFC PATCH] btrfs/066: Fix race condition by making 'subvolume stress' task to exit gracefully
Date: Thu, 17 Mar 2016 15:23:39 +0800 [thread overview]
Message-ID: <20160317072339.GW11419@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1458195269-965-1-git-send-email-chandan@linux.vnet.ibm.com>
On Thu, Mar 17, 2016 at 11:44:29AM +0530, Chandan Rajendra wrote:
> The following scenario can occur when running btrfs/066,
>
> Task A Task B Task C
>
> run_test()
> - Execute _btrfs_stress_subvolume()
> in a background shell.
> _btrfs_stress_subvolme()
> ...
> - fork & exec "mount"
> Mount subvolume on directory in $TEST_DIR
> - Wait for fsstress to finish do_mount()
> - kill shell process executing - btrfs_mount()
> _btrfs_stress_subvolume()
> i.e. Task B.
> - Init process becomes the parent
> of "subvolume mount" task
> i.e. Task C.
> - In case subvolume is mounted
> (which is not the case),
> unmount it.
> - Complete mounting subvolume
>
> Hence on the completion of one iteration of run_test(), the subvolume
> created inside the filesystem on $SCRATCH_DEV continues to be mounted on
> $TEST_DIR/$seq.mnt. Subsequent invocations of run_test() (called for
> remaining Btrfs profile configs) fail during _scratch_pool_mkfs.
>
> Instead of killing the 'subvolume stress' task, This commit uses a named
> pipe to inform the 'subvolume stress' task to break out of the infinite
> loop and exit.
A named pipe seems too heavy and complicated to me. How about breaking
out the loop in _btrfs_stress_subvolume on the existence of some file?
e.g.
_btrfs_stress_subvolume():
...
local stop_file=$5
while [ ! -e $stop_file ]; do
...
done
run_test():
...
local stop_file=$TEST_DIR/$seq.stop.$$
...
# make sure the stop sign is not there
rm -f $stop_file
_btrfs_stress_subvolume $SCRATCH_DEV $SCRATCH_MNT subvol_$$ $subvol_mnt $stop_file &
...
wait $fsstress_pid
touch $stop_file
kill $scrub_pid
wait
I didn't test it, as I can't reproduce the race, but I guess it should
work :)
Thanks,
Eryu
next prev parent reply other threads:[~2016-03-17 7:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 6:14 [RFC PATCH] btrfs/066: Fix race condition by making 'subvolume stress' task to exit gracefully Chandan Rajendra
2016-03-17 7:23 ` Eryu Guan [this message]
2016-03-17 9:12 ` Chandan Rajendra
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=20160317072339.GW11419@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=chandan@linux.vnet.ibm.com \
--cc=chandan@mykolab.com \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@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