diff options
author | Anand Jain <anand.jain@oracle.com> | 2016-04-14 12:24:10 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-04 09:52:44 +0200 |
commit | 8ed01abe7da6af62f2089da9a4c1fe839dc638f5 (patch) | |
tree | dfa4f934f163c593995b20a897df8d5872948b71 /fs/btrfs/dev-replace.c | |
parent | btrfs: refactor btrfs_dev_replace_start for reuse (diff) | |
download | linux-8ed01abe7da6af62f2089da9a4c1fe839dc638f5.tar.xz linux-8ed01abe7da6af62f2089da9a4c1fe839dc638f5.zip |
btrfs: s_bdev is not null after missing replace
Yauhen reported in the ML that s_bdev is null at mount, and
s_bdev gets updated to some device when missing device is
replaced, as because bdev is null for missing device, things
gets matched up. Fix this by checking if s_bdev is set. I
didn't want to completely remove updating s_bdev because
the future multi device support at vfs layer may need it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reported-by: Yauhen Kharuzhy <yauhen.kharuzhy@zavadatar.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 5aebedf12b5f..c93eec9ca433 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -569,7 +569,8 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, ASSERT(list_empty(&src_device->resized_list)); tgt_device->commit_total_bytes = src_device->commit_total_bytes; tgt_device->commit_bytes_used = src_device->bytes_used; - if (fs_info->sb->s_bdev == src_device->bdev) + if (fs_info->sb->s_bdev && + (fs_info->sb->s_bdev == src_device->bdev)) fs_info->sb->s_bdev = tgt_device->bdev; if (fs_info->fs_devices->latest_bdev == src_device->bdev) fs_info->fs_devices->latest_bdev = tgt_device->bdev; |