Thread (3 messages) 3 messages, 2 authors, 2021-10-28

Re: [PATCH] btrfs: Don't set balance as a running exclusive op in case of skip_balance

From: Nikolay Borisov <hidden>
Date: 2021-10-28 08:30:56


On 28.10.21 г. 10:57, Anand Jain wrote:
On 27/10/2021 21:53, Nikolay Borisov wrote:
quoted
Currently balance is set as a running exclusive op in
btrfs_recover_balance in case of remount and a paused balance. That's a
bit eager because btrfs_recover_balance executes always and is not
affected by the 'skip_balance' mount option. This can lead to cases in
which a user has mounted the filesystem with 'skip_balance' due to
running out of space yet is unable to add a device to rectify the ENOSPC
because balance is set as a running exclusive op.

Fix this by setting balance in btrfs_resume_balance_async which takes
into consideration whether 'skip_balance' has been added or not.
Hmm, no. I roughly remember it was purposefully to avoid replacing
intervened with the half-completed/paused balance. As below.
Not sure if it is ok now?

Before patch: Can't replace with a paused balance.

------------
$ btrfs bal start --full-balance /btrfs
balance paused by user

$ btrfs rep start /dev/vg/scratch1 /dev/vg/scratch0 /btrfs
ERROR: unable to start device replace, another exclusive operation
'balance' in progress

$ mount -o remount,ro /dev/vg/scratch1 /btrfs
$ mount -o remount,rw,skip_balance /dev/vg/scratch1 /btrfs

$ btrfs rep start /dev/vg/scratch1 /dev/vg/scratch0 /btrfs
ERROR: unable to start device replace, another exclusive operation
'balance' in progress

$ umount /btrfs
$ mount -o skip_balance /dev/vg/scratch1 /btrfs

$ btrfs rep start /dev/vg/scratch1 /dev/vg/scratch0 /btrfs
ERROR: unable to start device replace, another exclusive operation
'balance' in progress
------------


After patch: Replace is successful even if there is a paused balance.
That's a fair point, so the patch needs to be augmented such that only
ADD is allowed but other exclusive ops are not. I will look into it.

<snip>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help