diff options
author | Anand Jain <anand.jain@oracle.com> | 2016-04-14 06:24:10 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-05-04 03:52:44 -0400 |
commit | 8ed01abe7da6af62f2089da9a4c1fe839dc638f5 (patch) | |
tree | dfa4f934f163c593995b20a897df8d5872948b71 /fs/btrfs/dev-replace.c | |
parent | b5255456c529155730c837f8cfcea47e8feb85ca (diff) |
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, | |||
569 | ASSERT(list_empty(&src_device->resized_list)); | 569 | ASSERT(list_empty(&src_device->resized_list)); |
570 | tgt_device->commit_total_bytes = src_device->commit_total_bytes; | 570 | tgt_device->commit_total_bytes = src_device->commit_total_bytes; |
571 | tgt_device->commit_bytes_used = src_device->bytes_used; | 571 | tgt_device->commit_bytes_used = src_device->bytes_used; |
572 | if (fs_info->sb->s_bdev == src_device->bdev) | 572 | if (fs_info->sb->s_bdev && |
573 | (fs_info->sb->s_bdev == src_device->bdev)) | ||
573 | fs_info->sb->s_bdev = tgt_device->bdev; | 574 | fs_info->sb->s_bdev = tgt_device->bdev; |
574 | if (fs_info->fs_devices->latest_bdev == src_device->bdev) | 575 | if (fs_info->fs_devices->latest_bdev == src_device->bdev) |
575 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; | 576 | fs_info->fs_devices->latest_bdev = tgt_device->bdev; |