Commit 55e50e458e760f4d0c183978dcc20b07a7f6e20e
Committed by
Chris Mason
1 parent
83d4cfd4da
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
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>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
fs/btrfs/volumes.c
... | ... | @@ -796,7 +796,8 @@ |
796 | 796 | fs_devices->rotating = 1; |
797 | 797 | |
798 | 798 | fs_devices->open_devices++; |
799 | - if (device->writeable && !device->is_tgtdev_for_dev_replace) { | |
799 | + if (device->writeable && | |
800 | + device->devid != BTRFS_DEV_REPLACE_DEVID) { | |
800 | 801 | fs_devices->rw_devices++; |
801 | 802 | list_add(&device->dev_alloc_list, |
802 | 803 | &fs_devices->alloc_list); |