OSDN Git Service

btrfs: move and comment read-only check in btrfs_cancel_balance
authorDavid Sterba <dsterba@suse.com>
Wed, 21 Mar 2018 00:45:32 +0000 (01:45 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:26 +0000 (18:07 +0200)
commitcf7d20f447147105b6c1a98aaf586d03f51bcc25
treeef8d12d7c944256074ea06fb7b8a8fd68ec87963
parent3009a62f3b18230a000d1a91e9a676036487e834
btrfs: move and comment read-only check in btrfs_cancel_balance

Balance cannot be started on a read-only filesystem and will have to
finish/exit before eg. going to read-only via remount.

In case the filesystem is forcibly set to read-only after an error,
balance will finish anyway and if the cancel call is too fast it will
just wait for that to happen.

The last case is when the balance is paused after mount but it's
read-only and cancelling would want to delete the item. The test is
moved after the check if balance is running at all, as it looks more
logical to report "no balance running" instead of "read-only
filesystem".

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c