diff options
author | Omar Sandoval <osandov@osandov.com> | 2015-05-18 02:16:26 -0700 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-06-03 04:02:57 -0700 |
commit | 773cd04ec1911abb33cf9538b65f55b76cad5d92 (patch) | |
tree | b41feb18b6ba9694cf5d255d8994b6851e46868e /fs/btrfs/print-tree.h | |
parent | 0f31871f4411b5c0d42fb4403dec83a21a96100b (diff) | |
download | linux-773cd04ec1911abb33cf9538b65f55b76cad5d92.tar.gz |
Btrfs: lock superblock before remounting for rw subvol
Since commit 0723a0473fb4 ("btrfs: allow mounting btrfs subvolumes with
different ro/rw options"), when mounting a subvolume read/write when
another subvolume has previously been mounted read-only, we first do a
remount. However, this should be done with the superblock locked, as per
sync_filesystem():
/*
* We need to be protected against the filesystem going from
* r/o to r/w or vice versa.
*/
WARN_ON(!rwsem_is_locked(&sb->s_umount));
This WARN_ON can easily be hit with:
mkfs.btrfs -f /dev/vdb
mount /dev/vdb /mnt
btrfs subvol create /mnt/vol1
btrfs subvol create /mnt/vol2
umount /mnt
mount -oro,subvol=/vol1 /dev/vdb /mnt
mount -orw,subvol=/vol2 /dev/vdb /mnt2
Fixes: 0723a0473fb4 ("btrfs: allow mounting btrfs subvolumes with different ro/rw options")
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/print-tree.h')
0 files changed, 0 insertions, 0 deletions