summaryrefslogtreecommitdiff
path: root/fs/btrfs/dev-replace.c
diff options
context:
space:
mode:
authorAnand Jain <Anand.Jain@oracle.com>2014-08-13 14:24:21 +0800
committerChris Mason <clm@fb.com>2014-09-17 13:38:06 -0700
commit63dd86fa79db737a50f47488e5249f24e5acebc1 (patch)
tree9357a9901a9891d46b3dc48a88d5ceaf146ac790 /fs/btrfs/dev-replace.c
parent25e8e9113d340f0c32161ced0d4655eff8fed757 (diff)
downloadlwn-63dd86fa79db737a50f47488e5249f24e5acebc1.tar.gz
lwn-63dd86fa79db737a50f47488e5249f24e5acebc1.zip
btrfs: fix rw_devices miss match after seed replace
reproducer: reproducer: mount /dev/sdb /btrfs btrfs dev add /dev/sdc /btrfs btrfs rep start -B /dev/sdb /dev/sdd /btrfs umount /btrfs WARNING: CPU: 0 PID: 3882 at fs/btrfs/volumes.c:892 __btrfs_close_devices+0x1c8/0x200 [btrfs]() which is WARN_ON(fs_devices->rw_devices); The problem here is that we did not add one to the rw_devices when we replace the seed device with a writable device. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r--fs/btrfs/dev-replace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index eea26e1b2fda..fb0a7fa2f70c 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -562,6 +562,8 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
if (fs_info->fs_devices->latest_bdev == src_device->bdev)
fs_info->fs_devices->latest_bdev = tgt_device->bdev;
list_add(&tgt_device->dev_alloc_list, &fs_info->fs_devices->alloc_list);
+ if (src_device->fs_devices->seeding)
+ fs_info->fs_devices->rw_devices++;
/* replace the sysfs entry */
btrfs_kobj_rm_device(fs_info, src_device);