]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: do not do balance in readonly mode
authorLiu Bo <liubo2009@cn.fujitsu.com>
Fri, 11 May 2012 10:11:26 +0000 (18:11 +0800)
committerJosef Bacik <josef@redhat.com>
Wed, 30 May 2012 14:23:35 +0000 (10:23 -0400)
commit83661c0efd4de0f40780749efec5a9620c067f81
tree2c20508be673a9ebce14d27efa6ee05a04695787
parent28e2d18bebf7e0f905b9d8c17bb5bae897e5dc11
Btrfs: do not do balance in readonly mode

In normal cases, we would not be allowed to do balance in RO mode.
However, when we're using a seeding device and adding another device to sprout,
things will change:

$ mkfs.btrfs /dev/sdb7
$ btrfstune -S 1 /dev/sdb7
$ mount /dev/sdb7 /mnt/btrfs -o ro
$ btrfs fi bal /mnt/btrfs   -----------------------> fail.
$ btrfs dev add /dev/sdb8 /mnt/btrfs
$ btrfs fi bal /mnt/btrfs   -----------------------> works!

It should not be designed as an exception, and we'd better add another check for
mnt flags.

Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Reviewed-by: Josef Bacik <josef@redhat.com>
fs/btrfs/ioctl.c