FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH] btrfs/237: adjust uuid heuristics
@ 2022-02-12  1:19 Luis Chamberlain
  2022-02-14  7:47 ` Johannes Thumshirn
  0 siblings, 1 reply; 2+ messages in thread
From: Luis Chamberlain @ 2022-02-12  1:19 UTC (permalink / raw)
  To: fstests, johannes.thumshirn
  Cc: a.manzanares, Luis Chamberlain, Karel Zak, Pankaj Raghav

Using $(findmnt -n -o UUID mount-directory) only works on
util-linux v2.38, not on 2.37. Even debian-testing has util-linux
v2.37, so use a mechanism which has worked for longer to fetch the
UUID.

Without this the test fails on permission failure on accessing
the file /sys/fs/btrfs/"$uuid"/bg_reclaim_threshold as $uuid is
empty. So while at it, add a check to ensure the UUID is never
empty.

Cc: Karel Zak <kzak@redhat.com>
Cc: Pankaj Raghav <p.raghav@samsung.com>
Reported-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
 tests/btrfs/237 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/btrfs/237 b/tests/btrfs/237
index 5168777e..07c07e8e 100755
--- a/tests/btrfs/237
+++ b/tests/btrfs/237
@@ -41,7 +41,14 @@ zonesize=$((zonesize << 9))
 _scratch_mkfs >/dev/null 2>&1
 _scratch_mount -o commit=1 # 1s commit time to speed up test
 
-uuid=$(findmnt -n -o UUID "$SCRATCH_MNT")
+uuid=$($BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV |grep uuid: |\
+        awk '{print $NF}')
+
+if [[ "$uuid" == "" ]]; then
+	echo "UUID for $SCRATCH_DEV is empty, this is not expected"
+	exit 1
+fi
+
 reclaim_threshold=75
 echo $reclaim_threshold > /sys/fs/btrfs/"$uuid"/bg_reclaim_threshold
 fill_percent=$((reclaim_threshold + 2))
-- 
2.34.1


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

* Re: [PATCH] btrfs/237: adjust uuid heuristics
  2022-02-12  1:19 [PATCH] btrfs/237: adjust uuid heuristics Luis Chamberlain
@ 2022-02-14  7:47 ` Johannes Thumshirn
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Thumshirn @ 2022-02-14  7:47 UTC (permalink / raw)
  To: Luis Chamberlain, fstests@vger.kernel.org
  Cc: a.manzanares@samsung.com, Karel Zak, Pankaj Raghav

On 12/02/2022 02:19, Luis Chamberlain wrote:
> Using $(findmnt -n -o UUID mount-directory) only works on
> util-linux v2.38, not on 2.37. Even debian-testing has util-linux
> v2.37, so use a mechanism which has worked for longer to fetch the
> UUID.
> 
> Without this the test fails on permission failure on accessing
> the file /sys/fs/btrfs/"$uuid"/bg_reclaim_threshold as $uuid is
> empty. So while at it, add a check to ensure the UUID is never
> empty.
> 
> Cc: Karel Zak <kzak@redhat.com>
> Cc: Pankaj Raghav <p.raghav@samsung.com>
> Reported-by: Pankaj Raghav <p.raghav@samsung.com>
> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>

Thanks!
Minior nit below, otherwise
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>


> ---
>  tests/btrfs/237 | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/btrfs/237 b/tests/btrfs/237
> index 5168777e..07c07e8e 100755
> --- a/tests/btrfs/237
> +++ b/tests/btrfs/237
> @@ -41,7 +41,14 @@ zonesize=$((zonesize << 9))
>  _scratch_mkfs >/dev/null 2>&1
>  _scratch_mount -o commit=1 # 1s commit time to speed up test
>  
> -uuid=$(findmnt -n -o UUID "$SCRATCH_MNT")
> +uuid=$($BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV |grep uuid: |\
> +        awk '{print $NF}')

Think that should be $AWK_PROG


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

end of thread, other threads:[~2022-02-14  7:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-12  1:19 [PATCH] btrfs/237: adjust uuid heuristics Luis Chamberlain
2022-02-14  7:47 ` Johannes Thumshirn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox