mirror of https://gitee.com/openkylin/linux.git
Btrfs: do not add replace target to the alloc_list
If replace was suspended by the umount, replace target device is added to the fs_devices->alloc_list during a later mount. This is obviously wrong. ->is_tgtdev_for_dev_replace is supposed to guard against that, but ->is_tgtdev_for_dev_replace is (and can only ever be) initialized *after* everything is opened and fs_devices lists are populated. Fix this by checking the devid instead: for replace targets it's always equal to BTRFS_DEV_REPLACE_DEVID. Cc: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
parent
83d4cfd4da
commit
55e50e458e
|
@ -796,7 +796,8 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
|
|||
fs_devices->rotating = 1;
|
||||
|
||||
fs_devices->open_devices++;
|
||||
if (device->writeable && !device->is_tgtdev_for_dev_replace) {
|
||||
if (device->writeable &&
|
||||
device->devid != BTRFS_DEV_REPLACE_DEVID) {
|
||||
fs_devices->rw_devices++;
|
||||
list_add(&device->dev_alloc_list,
|
||||
&fs_devices->alloc_list);
|
||||
|
|
Loading…
Reference in New Issue