All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused
@ 2016-08-16 18:30 Jeff Mahoney
  2016-08-17  8:45 ` Eryu Guan
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Mahoney @ 2016-08-16 18:30 UTC (permalink / raw)
  To: linux-btrfs, fstests; +Cc: Qu Wenruo

Ensure that we can unmount a read-only file system when quota rescan
is paused from a previous read-write mount.

If the kernel has a separate bug where we are returning early while
waiting for the rescan worker, we can use that to un-hang the test,
and report both errors.

This issue is resolved by the following patch for the Linux kernel:
"btrfs: properly track when rescan worker is running"

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 tests/btrfs/131     | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/131.out |   3 ++
 tests/btrfs/group   |   1 +
 3 files changed, 104 insertions(+)
 create mode 100755 tests/btrfs/131
 create mode 100644 tests/btrfs/131.out

diff --git a/tests/btrfs/131 b/tests/btrfs/131
new file mode 100755
index 0000000..56c38a2
--- /dev/null
+++ b/tests/btrfs/131
@@ -0,0 +1,100 @@
+#! /bin/bash
+# FS QA Test 131
+#
+# Test for bug where read-only mounts will hang on umount when
+# a qgroup rescan was paused.  This also tests whether that hung
+# umount can be unhung by trying to make use of a separate bug that
+# means we can interrupt the wait for the rescan worker.  If that
+# happens, we report both errors.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 SUSE.  All Rights Reserved.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#-----------------------------------------------------------------------
+#
+
+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
+
+# We'll exit with a quota rescan paused
+_require_scratch_nocheck
+
+_require_btrfs
+BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
+_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
+TIMEOUT_PROG="`set_prog_path timeout`"
+_require_command "$TIMEOUT_PROG" timeout
+
+rm -f $seqres.full
+_scratch_mkfs >>$seqres.full 2>&1
+
+_scratch_mount
+cp -aR /lib/modules/$(uname -r) $SCRATCH_MNT
+
+# A qgroup rescan on an empty or small file system completes nearly
+# immediately.  We need to ensure that it runs long enough that it will
+# be paused on umount.  Snapshots slow down the rescan so we should see
+# the race without a lot of data.  This is an arbitrary number that
+# works on a ramdisk so it should be sufficient for any storage.
+for n in $(seq 1 100); do
+  _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/$n
+done
+_run_btrfs_util_prog quota enable $SCRATCH_MNT
+_scratch_unmount
+
+echo "read-write umount completed"
+
+# Confirm that the rescan is paused
+if ! $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
+	egrep -q 'flags ON|SCANNING|INCONSISTENT scan'; then
+	echo "qgroup rescan not paused."
+fi
+_scratch_mount -r
+
+# If the bug exists, this will hang.  If we can kill it, that's another bug.
+$TIMEOUT_PROG 10 umount $SCRATCH_MNT
+if test $? -eq 124 ; then
+    echo "umount hung but was killed"
+fi
+echo "read-only umount completed"
+
+# success, all done
+status=0
+exit
diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
new file mode 100644
index 0000000..845a501
--- /dev/null
+++ b/tests/btrfs/131.out
@@ -0,0 +1,3 @@
+QA output created by 131
+read-write umount completed
+read-only umount completed
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 6b29c05..929fa21 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -133,3 +133,4 @@
 128 auto quick send
 129 auto quick send
 130 auto clone send
+131 auto quick qgroup
-- 
1.8.5.6


-- 
Jeff Mahoney
SUSE Labs

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

* Re: [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused
  2016-08-16 18:30 [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused Jeff Mahoney
@ 2016-08-17  8:45 ` Eryu Guan
  2016-08-17  8:59     ` Qu Wenruo
  2016-08-19 19:20   ` Jeff Mahoney
  0 siblings, 2 replies; 5+ messages in thread
From: Eryu Guan @ 2016-08-17  8:45 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: linux-btrfs, fstests, Qu Wenruo

On Tue, Aug 16, 2016 at 02:30:21PM -0400, Jeff Mahoney wrote:
> Ensure that we can unmount a read-only file system when quota rescan
> is paused from a previous read-write mount.
> 
> If the kernel has a separate bug where we are returning early while
> waiting for the rescan worker, we can use that to un-hang the test,
> and report both errors.
> 
> This issue is resolved by the following patch for the Linux kernel:
> "btrfs: properly track when rescan worker is running"
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
>  tests/btrfs/131     | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/131.out |   3 ++
>  tests/btrfs/group   |   1 +
>  3 files changed, 104 insertions(+)
>  create mode 100755 tests/btrfs/131
>  create mode 100644 tests/btrfs/131.out
> 
> diff --git a/tests/btrfs/131 b/tests/btrfs/131
> new file mode 100755
> index 0000000..56c38a2
> --- /dev/null
> +++ b/tests/btrfs/131
> @@ -0,0 +1,100 @@
> +#! /bin/bash
> +# FS QA Test 131
> +#
> +# Test for bug where read-only mounts will hang on umount when
> +# a qgroup rescan was paused.  This also tests whether that hung
> +# umount can be unhung by trying to make use of a separate bug that
> +# means we can interrupt the wait for the rescan worker.  If that
> +# happens, we report both errors.
> +#
> +#-----------------------------------------------------------------------
> +# Copyright (c) 2016 SUSE.  All Rights Reserved.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it would be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write the Free Software Foundation,
> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#-----------------------------------------------------------------------
> +#
> +
> +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
> +
> +# We'll exit with a quota rescan paused
> +_require_scratch_nocheck
> +
> +_require_btrfs
> +BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
> +_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
> +TIMEOUT_PROG="`set_prog_path timeout`"
> +_require_command "$TIMEOUT_PROG" timeout

The "set_prog_path" calls belong to common/config, we only need
"_require_command" calls in test.

> +
> +rm -f $seqres.full
> +_scratch_mkfs >>$seqres.full 2>&1
> +
> +_scratch_mount
> +cp -aR /lib/modules/$(uname -r) $SCRATCH_MNT

Consider populating the filesystem using _populate_fs or fsstress?

> +
> +# A qgroup rescan on an empty or small file system completes nearly
> +# immediately.  We need to ensure that it runs long enough that it will
> +# be paused on umount.  Snapshots slow down the rescan so we should see
> +# the race without a lot of data.  This is an arbitrary number that
> +# works on a ramdisk so it should be sufficient for any storage.
> +for n in $(seq 1 100); do
> +  _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/$n

Use tab for indention.

> +done
> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
> +_scratch_unmount
> +
> +echo "read-write umount completed"
> +
> +# Confirm that the rescan is paused
> +if ! $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
> +	egrep -q 'flags ON|SCANNING|INCONSISTENT scan'; then
> +	echo "qgroup rescan not paused."
> +fi
> +_scratch_mount -r
> +
> +# If the bug exists, this will hang.  If we can kill it, that's another bug.
> +$TIMEOUT_PROG 10 umount $SCRATCH_MNT
> +if test $? -eq 124 ; then
> +    echo "umount hung but was killed"

I see this log with 4.8-rc1 kernel, is that expected?

Thanks,
Eryu

> +fi
> +echo "read-only umount completed"
> +
> +# success, all done
> +status=0
> +exit
> diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
> new file mode 100644
> index 0000000..845a501
> --- /dev/null
> +++ b/tests/btrfs/131.out
> @@ -0,0 +1,3 @@
> +QA output created by 131
> +read-write umount completed
> +read-only umount completed
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index 6b29c05..929fa21 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -133,3 +133,4 @@
>  128 auto quick send
>  129 auto quick send
>  130 auto clone send
> +131 auto quick qgroup
> -- 
> 1.8.5.6
> 
> 
> -- 
> Jeff Mahoney
> SUSE Labs
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused
  2016-08-17  8:45 ` Eryu Guan
@ 2016-08-17  8:59     ` Qu Wenruo
  2016-08-19 19:20   ` Jeff Mahoney
  1 sibling, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2016-08-17  8:59 UTC (permalink / raw)
  To: Eryu Guan, Jeff Mahoney; +Cc: linux-btrfs, fstests



At 08/17/2016 04:45 PM, Eryu Guan wrote:
> On Tue, Aug 16, 2016 at 02:30:21PM -0400, Jeff Mahoney wrote:
>> Ensure that we can unmount a read-only file system when quota rescan
>> is paused from a previous read-write mount.
>>
>> If the kernel has a separate bug where we are returning early while
>> waiting for the rescan worker, we can use that to un-hang the test,
>> and report both errors.
>>
>> This issue is resolved by the following patch for the Linux kernel:
>> "btrfs: properly track when rescan worker is running"
>>
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>>  tests/btrfs/131     | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/btrfs/131.out |   3 ++
>>  tests/btrfs/group   |   1 +
>>  3 files changed, 104 insertions(+)
>>  create mode 100755 tests/btrfs/131
>>  create mode 100644 tests/btrfs/131.out
>>
>> diff --git a/tests/btrfs/131 b/tests/btrfs/131
>> new file mode 100755
>> index 0000000..56c38a2
>> --- /dev/null
>> +++ b/tests/btrfs/131
>> @@ -0,0 +1,100 @@
>> +#! /bin/bash
>> +# FS QA Test 131
>> +#
>> +# Test for bug where read-only mounts will hang on umount when
>> +# a qgroup rescan was paused.  This also tests whether that hung
>> +# umount can be unhung by trying to make use of a separate bug that
>> +# means we can interrupt the wait for the rescan worker.  If that
>> +# happens, we report both errors.
>> +#
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2016 SUSE.  All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program; if not, write the Free Software Foundation,
>> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>> +#-----------------------------------------------------------------------
>> +#
>> +
>> +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
>> +
>> +# We'll exit with a quota rescan paused
>> +_require_scratch_nocheck
>> +
>> +_require_btrfs
>> +BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
>> +_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
>> +TIMEOUT_PROG="`set_prog_path timeout`"
>> +_require_command "$TIMEOUT_PROG" timeout
>
> The "set_prog_path" calls belong to common/config, we only need
> "_require_command" calls in test.
>
>> +
>> +rm -f $seqres.full
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +
>> +_scratch_mount
>> +cp -aR /lib/modules/$(uname -r) $SCRATCH_MNT
>
> Consider populating the filesystem using _populate_fs or fsstress?

If only want to increase tree level, best solution is to create a lot of 
small 2K files.
(Needs max_inline=2K incase user override it)

_populate_fs with -s 2048 is for this case.

If want normal files, -s 16384 would ensure it won't be inlined and 
still small enough for quick population.

>
>> +
>> +# A qgroup rescan on an empty or small file system completes nearly
>> +# immediately.  We need to ensure that it runs long enough that it will
>> +# be paused on umount.  Snapshots slow down the rescan so we should see
>> +# the race without a lot of data.  This is an arbitrary number that
>> +# works on a ramdisk so it should be sufficient for any storage.
>> +for n in $(seq 1 100); do
>> +  _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/$n
>
> Use tab for indention.
>
>> +done
>> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
>> +_scratch_unmount
>> +
>> +echo "read-write umount completed"
>> +
>> +# Confirm that the rescan is paused
>> +if ! $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
>> +	egrep -q 'flags ON|SCANNING|INCONSISTENT scan'; then
>> +	echo "qgroup rescan not paused."
>> +fi

I'm a little concerned of this operation.
As debug-tree output can change at any time, since it doesn't expect it 
to be used as a stable tool to exam some flag.

Although I don't have a better alternative though.

Thanks,
Qu

>> +_scratch_mount -r
>> +
>> +# If the bug exists, this will hang.  If we can kill it, that's another bug.
>> +$TIMEOUT_PROG 10 umount $SCRATCH_MNT
>> +if test $? -eq 124 ; then
>> +    echo "umount hung but was killed"
>
> I see this log with 4.8-rc1 kernel, is that expected?
>
> Thanks,
> Eryu
>
>> +fi
>> +echo "read-only umount completed"
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
>> new file mode 100644
>> index 0000000..845a501
>> --- /dev/null
>> +++ b/tests/btrfs/131.out
>> @@ -0,0 +1,3 @@
>> +QA output created by 131
>> +read-write umount completed
>> +read-only umount completed
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index 6b29c05..929fa21 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -133,3 +133,4 @@
>>  128 auto quick send
>>  129 auto quick send
>>  130 auto clone send
>> +131 auto quick qgroup
>> --
>> 1.8.5.6
>>
>>
>> --
>> Jeff Mahoney
>> SUSE Labs
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>



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

* Re: [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused
@ 2016-08-17  8:59     ` Qu Wenruo
  0 siblings, 0 replies; 5+ messages in thread
From: Qu Wenruo @ 2016-08-17  8:59 UTC (permalink / raw)
  To: Eryu Guan, Jeff Mahoney; +Cc: linux-btrfs, fstests



At 08/17/2016 04:45 PM, Eryu Guan wrote:
> On Tue, Aug 16, 2016 at 02:30:21PM -0400, Jeff Mahoney wrote:
>> Ensure that we can unmount a read-only file system when quota rescan
>> is paused from a previous read-write mount.
>>
>> If the kernel has a separate bug where we are returning early while
>> waiting for the rescan worker, we can use that to un-hang the test,
>> and report both errors.
>>
>> This issue is resolved by the following patch for the Linux kernel:
>> "btrfs: properly track when rescan worker is running"
>>
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>>  tests/btrfs/131     | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  tests/btrfs/131.out |   3 ++
>>  tests/btrfs/group   |   1 +
>>  3 files changed, 104 insertions(+)
>>  create mode 100755 tests/btrfs/131
>>  create mode 100644 tests/btrfs/131.out
>>
>> diff --git a/tests/btrfs/131 b/tests/btrfs/131
>> new file mode 100755
>> index 0000000..56c38a2
>> --- /dev/null
>> +++ b/tests/btrfs/131
>> @@ -0,0 +1,100 @@
>> +#! /bin/bash
>> +# FS QA Test 131
>> +#
>> +# Test for bug where read-only mounts will hang on umount when
>> +# a qgroup rescan was paused.  This also tests whether that hung
>> +# umount can be unhung by trying to make use of a separate bug that
>> +# means we can interrupt the wait for the rescan worker.  If that
>> +# happens, we report both errors.
>> +#
>> +#-----------------------------------------------------------------------
>> +# Copyright (c) 2016 SUSE.  All Rights Reserved.
>> +#
>> +# This program is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU General Public License as
>> +# published by the Free Software Foundation.
>> +#
>> +# This program is distributed in the hope that it would be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program; if not, write the Free Software Foundation,
>> +# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
>> +#-----------------------------------------------------------------------
>> +#
>> +
>> +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
>> +
>> +# We'll exit with a quota rescan paused
>> +_require_scratch_nocheck
>> +
>> +_require_btrfs
>> +BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
>> +_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
>> +TIMEOUT_PROG="`set_prog_path timeout`"
>> +_require_command "$TIMEOUT_PROG" timeout
>
> The "set_prog_path" calls belong to common/config, we only need
> "_require_command" calls in test.
>
>> +
>> +rm -f $seqres.full
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +
>> +_scratch_mount
>> +cp -aR /lib/modules/$(uname -r) $SCRATCH_MNT
>
> Consider populating the filesystem using _populate_fs or fsstress?

If only want to increase tree level, best solution is to create a lot of 
small 2K files.
(Needs max_inline=2K incase user override it)

_populate_fs with -s 2048 is for this case.

If want normal files, -s 16384 would ensure it won't be inlined and 
still small enough for quick population.

>
>> +
>> +# A qgroup rescan on an empty or small file system completes nearly
>> +# immediately.  We need to ensure that it runs long enough that it will
>> +# be paused on umount.  Snapshots slow down the rescan so we should see
>> +# the race without a lot of data.  This is an arbitrary number that
>> +# works on a ramdisk so it should be sufficient for any storage.
>> +for n in $(seq 1 100); do
>> +  _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/$n
>
> Use tab for indention.
>
>> +done
>> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
>> +_scratch_unmount
>> +
>> +echo "read-write umount completed"
>> +
>> +# Confirm that the rescan is paused
>> +if ! $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
>> +	egrep -q 'flags ON|SCANNING|INCONSISTENT scan'; then
>> +	echo "qgroup rescan not paused."
>> +fi

I'm a little concerned of this operation.
As debug-tree output can change at any time, since it doesn't expect it 
to be used as a stable tool to exam some flag.

Although I don't have a better alternative though.

Thanks,
Qu

>> +_scratch_mount -r
>> +
>> +# If the bug exists, this will hang.  If we can kill it, that's another bug.
>> +$TIMEOUT_PROG 10 umount $SCRATCH_MNT
>> +if test $? -eq 124 ; then
>> +    echo "umount hung but was killed"
>
> I see this log with 4.8-rc1 kernel, is that expected?
>
> Thanks,
> Eryu
>
>> +fi
>> +echo "read-only umount completed"
>> +
>> +# success, all done
>> +status=0
>> +exit
>> diff --git a/tests/btrfs/131.out b/tests/btrfs/131.out
>> new file mode 100644
>> index 0000000..845a501
>> --- /dev/null
>> +++ b/tests/btrfs/131.out
>> @@ -0,0 +1,3 @@
>> +QA output created by 131
>> +read-write umount completed
>> +read-only umount completed
>> diff --git a/tests/btrfs/group b/tests/btrfs/group
>> index 6b29c05..929fa21 100644
>> --- a/tests/btrfs/group
>> +++ b/tests/btrfs/group
>> @@ -133,3 +133,4 @@
>>  128 auto quick send
>>  129 auto quick send
>>  130 auto clone send
>> +131 auto quick qgroup
>> --
>> 1.8.5.6
>>
>>
>> --
>> Jeff Mahoney
>> SUSE Labs
>> --
>> To unsubscribe from this list: send the line "unsubscribe fstests" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>



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

* Re: [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused
  2016-08-17  8:45 ` Eryu Guan
  2016-08-17  8:59     ` Qu Wenruo
@ 2016-08-19 19:20   ` Jeff Mahoney
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff Mahoney @ 2016-08-19 19:20 UTC (permalink / raw)
  To: Eryu Guan; +Cc: linux-btrfs, fstests, Qu Wenruo


[-- Attachment #1.1: Type: text/plain, Size: 2108 bytes --]

On 8/17/16 4:45 AM, Eryu Guan wrote:
> On Tue, Aug 16, 2016 at 02:30:21PM -0400, Jeff Mahoney wrote:
>> +_require_btrfs
>> +BTRFS_DEBUG_TREE_PROG="`set_prog_path btrfs-debug-tree`"
>> +_require_command "$BTRFS_DEBUG_TREE_PROG" btrfs-debug-tree
>> +TIMEOUT_PROG="`set_prog_path timeout`"
>> +_require_command "$TIMEOUT_PROG" timeout
> 
> The "set_prog_path" calls belong to common/config, we only need
> "_require_command" calls in test.

Ok, then we should probably fix up the existing cases that do this in
tests/ since this and the cp /lib/modules thing were copied from other
test cases in the repo.

>> +
>> +rm -f $seqres.full
>> +_scratch_mkfs >>$seqres.full 2>&1
>> +
>> +_scratch_mount
>> +cp -aR /lib/modules/$(uname -r) $SCRATCH_MNT
> 
> Consider populating the filesystem using _populate_fs or fsstress?

Same.

>> +
>> +# A qgroup rescan on an empty or small file system completes nearly
>> +# immediately.  We need to ensure that it runs long enough that it will
>> +# be paused on umount.  Snapshots slow down the rescan so we should see
>> +# the race without a lot of data.  This is an arbitrary number that
>> +# works on a ramdisk so it should be sufficient for any storage.
>> +for n in $(seq 1 100); do
>> +  _run_btrfs_util_prog subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/$n
> 
> Use tab for indention.

Ok.

>> +done
>> +_run_btrfs_util_prog quota enable $SCRATCH_MNT
>> +_scratch_unmount
>> +
>> +echo "read-write umount completed"
>> +
>> +# Confirm that the rescan is paused
>> +if ! $BTRFS_DEBUG_TREE_PROG $SCRATCH_DEV | \
>> +	egrep -q 'flags ON|SCANNING|INCONSISTENT scan'; then
>> +	echo "qgroup rescan not paused."
>> +fi
>> +_scratch_mount -r
>> +
>> +# If the bug exists, this will hang.  If we can kill it, that's another bug.
>> +$TIMEOUT_PROG 10 umount $SCRATCH_MNT
>> +if test $? -eq 124 ; then
>> +    echo "umount hung but was killed"
> 
> I see this log with 4.8-rc1 kernel, is that expected?

Yes, the patch was posted this week and hasn't landed yet.

Thanks,

-Jeff

-- 
Jeff Mahoney
SUSE Labs


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 881 bytes --]

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

end of thread, other threads:[~2016-08-19 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 18:30 [PATCH 1/2] btrfs/131: test for umount of read-only fs when quota rescan is paused Jeff Mahoney
2016-08-17  8:45 ` Eryu Guan
2016-08-17  8:59   ` Qu Wenruo
2016-08-17  8:59     ` Qu Wenruo
2016-08-19 19:20   ` Jeff Mahoney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.