From: Anand Jain Date: Thu, 28 Sep 2017 06:51:09 +0000 (+0800) Subject: btrfs: undo writable superblocke when sprouting fails X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=0af2c4bf5a012a40a2f9230458087d7f068339d0;p=openwrt%2Fstaging%2Fblogic.git btrfs: undo writable superblocke when sprouting fails When new device is being added to seed FS, seed FS is marked writable, but when we fail to bring in the new device, we missed to undo the writable part. This patch fixes it. Signed-off-by: Anand Jain Reviewed-by: Nikolay Borisov Signed-off-by: David Sterba --- diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index ac1e8686ba78..0be58b5a320c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2496,6 +2496,8 @@ int btrfs_init_new_device(struct btrfs_fs_info *fs_info, const char *device_path return ret; error_trans: + if (seeding_dev) + sb->s_flags |= MS_RDONLY; btrfs_end_transaction(trans); rcu_string_free(device->name); btrfs_sysfs_rm_device_link(fs_info->fs_devices, device);