linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe Manana <fdmanana@gmail.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Qu Wenruo <wqu@suse.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] fstests: btrfs: Introduce stress test for deadlock between snapshot delete and other read-write operations
Date: Tue, 12 Feb 2019 10:59:51 +0000	[thread overview]
Message-ID: <CAL3q7H6bm0yWdQ4La0vk2C+n5+++9kPhxe-A3WyaN3j2HFyX4A@mail.gmail.com> (raw)
In-Reply-To: <bd51a34e-0d80-0e89-36cd-6256c77067ab@gmx.com>

On Tue, Feb 12, 2019 at 5:14 AM Qu Wenruo <quwenruo.btrfs@gmx.com> wrote:
>
>
>
> On 2019/1/11 下午1:01, Qu Wenruo wrote:
> [snip]
> > +# FS QA Test 179
> > +#
> > +# Test if btrfs will lockup at subvolume deletion when qgroups are enabled.
> > +#
> > +# This bug is going to be fixed by a patch for the kernel titled
> > +# "btrfs: qgroup: Don't trigger backref walk at delayed ref insert time".
>
> Although the test case is already merged, btrfs community is going to
> use a much better fix than this.
>
> Should I update the patch in this test case after the fix get merged
> upstream?

Yes please. Why shouldn't it be updated? It makes no sense to leave a
stale comment.

>
> Thanks,
> Qu
>
> > +#
> > +seq=`basename $0`
> > +seqres=$RESULT_DIR/$seq
> > +echo "QA output created by $seq"
> > +
> > +here=`pwd`
> > +tmp=/tmp/$$
> > +status=1     # failure is the default!
> > +trap "_cleanup; exit \$status" 0 1 2 3 15
> > +
> > +_cleanup()
> > +{
> > +     cd /
> > +     rm -f $tmp.*
> > +}
> > +
> > +# get standard environment, filters and checks
> > +. ./common/rc
> > +. ./common/filter
> > +
> > +# remove previous $seqres.full before test
> > +rm -f $seqres.full
> > +
> > +# real QA test starts here
> > +
> > +# Modify as appropriate.
> > +_supported_fs btrfs
> > +_supported_os Linux
> > +_require_scratch
> > +
> > +# default sleep interval
> > +sleep_time=1
> > +
> > +# stress test runtime
> > +runtime=120
> > +
> > +_scratch_mkfs > /dev/null 2>&1
> > +_scratch_mount
> > +
> > +mkdir -p "$SCRATCH_MNT/snapshots"
> > +$BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/src" > /dev/null
> > +$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
> > +$BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
> > +
> > +fill_workload()
> > +{
> > +     trap "wait; exit" SIGTERM
> > +     local i=0
> > +     while true; do
> > +             _pwrite_byte 0xcd 0 8K "$SCRATCH_MNT/src/large_$i" > /dev/null
> > +             _pwrite_byte 0xcd 0 2K "$SCRATCH_MNT/src/inline_$i" > /dev/null
> > +
> > +             # Randomly remove some files for every 5 loop
> > +             if [ $(( $i % 5 )) -eq 0 ]; then
> > +                     victim=$(ls "$SCRATCH_MNT/src" | sort -R | head -n1)
> > +                     rm "$SCRATCH_MNT/src/$victim"
> > +             fi
> > +             i=$((i + 1))
> > +     done
> > +}
> > +
> > +snapshot_workload()
> > +{
> > +     trap "wait; exit" SIGTERM
> > +     local i=0
> > +     while true; do
> > +             sleep $sleep_time
> > +             $BTRFS_UTIL_PROG subvolume snapshot "$SCRATCH_MNT/src" \
> > +                     "$SCRATCH_MNT/snapshots/$i" > /dev/null
> > +             i=$((i + 1))
> > +     done
> > +}
> > +
> > +delete_workload()
> > +{
> > +     trap "wait; exit" SIGTERM
> > +     while true; do
> > +             sleep $((sleep_time * 2))
> > +             victim=$(ls "$SCRATCH_MNT/snapshots" | sort -R | head -n1)
> > +             $BTRFS_UTIL_PROG subvolume delete \
> > +                     "$SCRATCH_MNT/snapshots/$victim" > /dev/null
> > +     done
> > +}
> > +
> > +fill_workload &
> > +fill_pid=$!
> > +
> > +sleep $((sleep_time * 2))
> > +snapshot_workload &
> > +snapshot_pid=$!
> > +delete_workload &
> > +delete_pid=$!
> > +
> > +sleep $runtime
> > +kill $fill_pid
> > +wait $fill_pid
> > +kill $snapshot_pid
> > +wait $snapshot_pid
> > +kill $delete_pid
> > +wait $delete_pid
> > +
> > +# success, all done
> > +echo "Silence is golden"
> > +
> > +status=0
> > +exit
> > diff --git a/tests/btrfs/179.out b/tests/btrfs/179.out
> > new file mode 100644
> > index 000000000000..cb9eba3d34b1
> > --- /dev/null
> > +++ b/tests/btrfs/179.out
> > @@ -0,0 +1,2 @@
> > +QA output created by 179
> > +Silence is golden
> > diff --git a/tests/btrfs/group b/tests/btrfs/group
> > index 04c0254aa4bf..46dd3c9523c2 100644
> > --- a/tests/btrfs/group
> > +++ b/tests/btrfs/group
> > @@ -181,3 +181,4 @@
> >  176 auto quick swap volume
> >  177 auto quick swap balance
> >  178 auto quick send
> > +179 auto qgroup dangerous
> >
>


-- 
Filipe David Manana,

“Whether you think you can, or you think you can't — you're right.”

      reply	other threads:[~2019-02-12 11:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-11  5:01 [PATCH v2 2/2] fstests: btrfs: Introduce stress test for deadlock between snapshot delete and other read-write operations Qu Wenruo
2019-01-11 10:37 ` Filipe Manana
2019-02-12  5:14 ` Qu Wenruo
2019-02-12 10:59   ` Filipe Manana [this message]

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=CAL3q7H6bm0yWdQ4La0vk2C+n5+++9kPhxe-A3WyaN3j2HFyX4A@mail.gmail.com \
    --to=fdmanana@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.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 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).