]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: don't allow the replace procedure on read only filesystems
authorStefan Behrens <sbehrens@giantdisaster.de>
Mon, 19 Aug 2013 16:51:13 +0000 (18:51 +0200)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:16:02 +0000 (08:16 -0400)
commit36c43dc752137cca4266e1221a86e25563d9ca93
tree303a1cc7643df7b96ca367b3d42ab7089e9b8321
parent9ab8141cef824357eaa7f7ae073b7290fb2949b1
Btrfs: don't allow the replace procedure on read only filesystems

If you start the replace procedure on a read only filesystem, at
the end the procedure fails to write the updated dev_items to the
chunk tree. The problem is that this error is not indicated except
for a WARN_ON(). If the user now thinks that everything was done
as expected and destroys the source device (with mkfs or with a
hammer). The next mount fails with "failed to read chunk root" and
the filesystem is gone.

This commit adds code to fail the attempt to start the replace
procedure if the filesystem is mounted read-only.

Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Cc: <stable@vger.kernel.org> # 3.10+
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/ioctl.c