Linux-BTRFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] btrfs: Test if btrfs will report false ENOSPC error balnacing small metadata chunk
@ 2019-01-29  7:27 Qu Wenruo
  2019-01-29 11:26 ` Filipe Manana
  0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2019-01-29  7:27 UTC (permalink / raw)
  To: linux-btrfs; +Cc: fstests

This is a long existing bug, caused by over-estimated metadata
space_info::bytes_may_use.

There is one purposed patch for btrfs-progs to fix it, titled:
"btrfs-progs: balance: Sync the fs before balancing metadata chunks"

The test case itself is almost the same as btrfs/181, which use small
files to bump a reserved space to trigger the false alert.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/btrfs/182     | 60 +++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/182.out |  2 ++
 tests/btrfs/group   |  1 +
 3 files changed, 63 insertions(+)
 create mode 100755 tests/btrfs/182
 create mode 100644 tests/btrfs/182.out

diff --git a/tests/btrfs/182 b/tests/btrfs/182
new file mode 100755
index 00000000..61efcb9e
--- /dev/null
+++ b/tests/btrfs/182
@@ -0,0 +1,60 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
+#
+# FS QA Test 182
+#
+# Test if balance will report false ENOSPC error
+#
+# This is a long existing bug, caused by over-estimated metadata
+# space_info::bytes_may_use.
+# There is one purposed patch for btrfs-progs to fix it, titled:
+# "btrfs-progs: balance: Sync the fs before balancing metadata chunks"
+#
+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
+
+nr_files=1024
+
+_scratch_mkfs > /dev/null
+_scratch_mount
+
+$BTRFS_UTIL_PROG subv create "$SCRATCH_MNT/subvol" > /dev/null
+
+# Create some small files to take up enough metadata reserved space 
+for ((i = 0; i < $nr_files; i++)) do
+	_pwrite_byte 0xcd 0 1K "$SCRATCH_MNT/subvol/file_$i" > /dev/null
+done
+
+$BTRFS_UTIL_PROG balance start -m "$SCRATCH_MNT" > /dev/null
+
+# success, all done
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/182.out b/tests/btrfs/182.out
new file mode 100644
index 00000000..53d28e50
--- /dev/null
+++ b/tests/btrfs/182.out
@@ -0,0 +1,2 @@
+QA output created by 182
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index 0db485cb..e32c84e4 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -184,3 +184,4 @@
 179 auto qgroup dangerous
 180 auto quick qgroup limit
 181 auto quick balance
+182 auto quick balance
-- 
2.18.0


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

* Re: [PATCH] btrfs: Test if btrfs will report false ENOSPC error balnacing small metadata chunk
  2019-01-29  7:27 [PATCH] btrfs: Test if btrfs will report false ENOSPC error balnacing small metadata chunk Qu Wenruo
@ 2019-01-29 11:26 ` Filipe Manana
  0 siblings, 0 replies; 2+ messages in thread
From: Filipe Manana @ 2019-01-29 11:26 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, fstests

On Tue, Jan 29, 2019 at 7:28 AM Qu Wenruo <wqu@suse.com> wrote:
>
> This is a long existing bug, caused by over-estimated metadata
> space_info::bytes_may_use.

Nop, this is a test case :)
The sentence should be more like "This is a test case for a long
existing bug, ...".

>
> There is one purposed patch for btrfs-progs to fix it, titled:

purposed -> proposed

> "btrfs-progs: balance: Sync the fs before balancing metadata chunks"
>
> The test case itself is almost the same as btrfs/181, which use small

use -> uses

> files to bump a reserved space to trigger the false alert.

a -> the

Also, for the subject, there's the typo "balnacing".

>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
>  tests/btrfs/182     | 60 +++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/182.out |  2 ++
>  tests/btrfs/group   |  1 +
>  3 files changed, 63 insertions(+)
>  create mode 100755 tests/btrfs/182
>  create mode 100644 tests/btrfs/182.out
>
> diff --git a/tests/btrfs/182 b/tests/btrfs/182
> new file mode 100755
> index 00000000..61efcb9e
> --- /dev/null
> +++ b/tests/btrfs/182
> @@ -0,0 +1,60 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
> +#
> +# FS QA Test 182
> +#
> +# Test if balance will report false ENOSPC error
> +#
> +# This is a long existing bug, caused by over-estimated metadata
> +# space_info::bytes_may_use.
> +# There is one purposed patch for btrfs-progs to fix it, titled:

purposed -> proposed

> +# "btrfs-progs: balance: Sync the fs before balancing metadata chunks"
> +#
> +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
> +
> +nr_files=1024
> +
> +_scratch_mkfs > /dev/null
> +_scratch_mount
> +
> +$BTRFS_UTIL_PROG subv create "$SCRATCH_MNT/subvol" > /dev/null

subv -> subvolume

We always prefer full command names.

Other than that, it looks good.

Reviewed-by: Filipe Manana <fdmanana@suse.com>

> +
> +# Create some small files to take up enough metadata reserved space
> +for ((i = 0; i < $nr_files; i++)) do
> +       _pwrite_byte 0xcd 0 1K "$SCRATCH_MNT/subvol/file_$i" > /dev/null
> +done
> +
> +$BTRFS_UTIL_PROG balance start -m "$SCRATCH_MNT" > /dev/null
> +
> +# success, all done
> +echo "Silence is golden"
> +status=0
> +exit
> diff --git a/tests/btrfs/182.out b/tests/btrfs/182.out
> new file mode 100644
> index 00000000..53d28e50
> --- /dev/null
> +++ b/tests/btrfs/182.out
> @@ -0,0 +1,2 @@
> +QA output created by 182
> +Silence is golden
> diff --git a/tests/btrfs/group b/tests/btrfs/group
> index 0db485cb..e32c84e4 100644
> --- a/tests/btrfs/group
> +++ b/tests/btrfs/group
> @@ -184,3 +184,4 @@
>  179 auto qgroup dangerous
>  180 auto quick qgroup limit
>  181 auto quick balance
> +182 auto quick balance
> --
> 2.18.0
>


-- 
Filipe David Manana,

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

^ 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 --
2019-01-29  7:27 [PATCH] btrfs: Test if btrfs will report false ENOSPC error balnacing small metadata chunk Qu Wenruo
2019-01-29 11:26 ` Filipe Manana

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 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/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


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