From: Omar Sandoval Date: Mon, 18 May 2015 09:16:26 +0000 (-0700) Subject: Btrfs: lock superblock before remounting for rw subvol X-Git-Tag: omap-for-v4.2/fixes-rc1^2~69^2~43 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=773cd04ec1911abb33cf9538b65f55b76cad5d92;p=pandora-kernel.git 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 Signed-off-by: Omar Sandoval Signed-off-by: Chris Mason --- Reading git-diff-tree failed