btrfs: undo writable superblocke when sprouting fails
authorAnand Jain <anand.jain@oracle.com>
Thu, 28 Sep 2017 06:51:09 +0000 (14:51 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 11:27:58 +0000 (12:27 +0100)
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 <anand.jain@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index ac1e8686ba7815074adc50dc9ac7c66a04165df2..0be58b5a320cfca5a75d9929c85244e01f922cf7 100644 (file)
@@ -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);