Skip to content

Commit 2018ef1

Browse files
josefbacikkdave
authored andcommitted
btrfs: use the original mount's mount options for the legacy reconfigure
btrfs/330, which tests our old trick to allow mount -o ro,subvol=/x /dev/sda1 /foo mount -o rw,subvol=/y /dev/sda1 /bar fails on the block group tree. This is because we aren't preserving the mount options for what is essentially a remount, and thus we're ending up without the FREE_SPACE_TREE mount option, which triggers our free space tree delete codepath. This isn't possible with the block group tree and thus it falls over. Fix this by making sure we copy the existing mount options for the existing fs mount over in this case. Fixes: f044b31 ("btrfs: handle the ro->rw transition for mounting different subvolumes") Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent a208b3f commit 2018ef1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

fs/btrfs/super.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,14 @@ static int btrfs_reconfigure(struct fs_context *fc)
14511451

14521452
btrfs_info_to_ctx(fs_info, &old_ctx);
14531453

1454+
/*
1455+
* This is our "bind mount" trick, we don't want to allow the user to do
1456+
* anything other than mount a different ro/rw and a different subvol,
1457+
* all of the mount options should be maintained.
1458+
*/
1459+
if (mount_reconfigure)
1460+
ctx->mount_opt = old_ctx.mount_opt;
1461+
14541462
sync_filesystem(sb);
14551463
set_bit(BTRFS_FS_STATE_REMOUNTING, &fs_info->fs_state);
14561464

0 commit comments

Comments
 (0)