diff mbox series

btrfs: fix rescan helper

Message ID d51adc803f344fb0bb5e63243e94f94f287ac2c0.1696009118.git.boris@bur.io (mailing list archive)
State New, archived
Headers show
Series btrfs: fix rescan helper | expand

Commit Message

Boris Burkov Sept. 29, 2023, 5:43 p.m. UTC
rescan -w silently handles the case where a rescan is already running.
rescan -W works even in squota mode, so it is insufficient to implement
the requires. Therefore, preface the rescan -w with rescan -W, which
should reliably trigger a real rescan start.

This results in an extra log line reliably appearing in stdout, so also
redirect the output to $seqres.full.

btrfs/022 and btrfs/057 now pass with and without mkfs -O squota.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 common/btrfs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Anand Jain Sept. 30, 2023, 9:37 a.m. UTC | #1
On 30/09/2023 01:43, Boris Burkov wrote:
> rescan -w silently handles the case where a rescan is already running.
> rescan -W works even in squota mode, so it is insufficient to implement
> the requires. Therefore, preface the rescan -w with rescan -W, which
> should reliably trigger a real rescan start.
> 
> This results in an extra log line reliably appearing in stdout, so also
> redirect the output to $seqres.full.
> 
> btrfs/022 and btrfs/057 now pass with and without mkfs -O squota.
> 
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
>   common/btrfs | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/common/btrfs b/common/btrfs
> index 34fa3a157..eff8e8386 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -724,7 +724,10 @@ _require_qgroup_rescan()
>   	_scratch_mkfs >>$seqres.full 2>&1
>   	_scratch_mount
>   	_run_btrfs_util_prog quota enable $SCRATCH_MNT
> -	$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT ||  _notrun "not able to run quota rescan"
> +	# Wait for the first rescan.
> +	$BTRFS_UTIL_PROG quota rescan -W $SCRATCH_MNT || _notrun "not able to wait on a quota rescan"
> +	# Make sure we can start a rescan.
> +	$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full || _notrun "not able to run quota rescan"
>   	_scratch_unmount
>   }
>   

Now updated.
Thanks, Anand
diff mbox series

Patch

diff --git a/common/btrfs b/common/btrfs
index 34fa3a157..eff8e8386 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -724,7 +724,10 @@  _require_qgroup_rescan()
 	_scratch_mkfs >>$seqres.full 2>&1
 	_scratch_mount
 	_run_btrfs_util_prog quota enable $SCRATCH_MNT
-	$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT ||  _notrun "not able to run quota rescan"
+	# Wait for the first rescan.
+	$BTRFS_UTIL_PROG quota rescan -W $SCRATCH_MNT || _notrun "not able to wait on a quota rescan"
+	# Make sure we can start a rescan.
+	$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full || _notrun "not able to run quota rescan"
 	_scratch_unmount
 }