diff options
author | Anand Jain <anand.jain@oracle.com> | 2017-10-17 06:53:50 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-11-01 20:45:34 +0100 |
commit | 6dd38f81f9c90fb5eec358d46f393f4366c9de50 (patch) | |
tree | bb4e3b551f60bc42afe610fb69a5a68abeedb381 /fs/btrfs | |
parent | fa4d885a482ef52ad3efa12a5799a3f6408b0718 (diff) | |
download | op-kernel-dev-6dd38f81f9c90fb5eec358d46f393f4366c9de50.zip op-kernel-dev-6dd38f81f9c90fb5eec358d46f393f4366c9de50.tar.gz |
btrfs: remove BUG_ON in btrfs_rm_dev_replace_free_srcdev()
That was only an extra check to tackle a few bugs around this area, now
its safe to remove it. Replace it by an ASSERT.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/volumes.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 11d7707..f1ecb93 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2016,19 +2016,20 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_fs_info *fs_info, } btrfs_close_bdev(srcdev); - call_rcu(&srcdev->rcu, free_device); - /* - * unless fs_devices is seed fs, num_devices shouldn't go - * zero - */ - BUG_ON(!fs_devices->num_devices && !fs_devices->seeding); - /* if this is no devs we rather delete the fs_devices */ if (!fs_devices->num_devices) { struct btrfs_fs_devices *tmp_fs_devices; + /* + * On a mounted FS, num_devices can't be zero unless it's a + * seed. In case of a seed device being replaced, the replace + * target added to the sprout FS, so there will be no more + * device left under the seed FS. + */ + ASSERT(fs_devices->seeding); + tmp_fs_devices = fs_info->fs_devices; while (tmp_fs_devices) { if (tmp_fs_devices->seed == fs_devices) { |