* [PATCH] Btrfs: do not add replace target to the alloc_list
@ 2013-09-01 15:56 Ilya Dryomov
2013-09-04 7:13 ` Stefan Behrens
0 siblings, 1 reply; 2+ messages in thread
From: Ilya Dryomov @ 2013-09-01 15:56 UTC (permalink / raw)
To: linux-btrfs; +Cc: Chris Mason, Stefan Behrens, idryomov
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>
---
At first I thought this was caused by my btrfs_device rollback patch,
but no, it just made it easier to spot -- previously one had to reboot
or rmmod/insmod before mounting a suspended replace.
fs/btrfs/volumes.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index c9a0977..5b99f19 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -793,7 +793,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);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Btrfs: do not add replace target to the alloc_list
2013-09-01 15:56 [PATCH] Btrfs: do not add replace target to the alloc_list Ilya Dryomov
@ 2013-09-04 7:13 ` Stefan Behrens
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Behrens @ 2013-09-04 7:13 UTC (permalink / raw)
To: Ilya Dryomov; +Cc: linux-btrfs, Chris Mason
On Sun, 1 Sep 2013 18:56:44 +0300, Ilya Dryomov wrote:
> 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>
> ---
> At first I thought this was caused by my btrfs_device rollback patch,
> but no, it just made it easier to spot -- previously one had to reboot
> or rmmod/insmod before mounting a suspended replace.
>
> fs/btrfs/volumes.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index c9a0977..5b99f19 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -793,7 +793,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);
>
Reviewed-by: Stefan Behrens <sbehrens@giantdisaster.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-04 7:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-01 15:56 [PATCH] Btrfs: do not add replace target to the alloc_list Ilya Dryomov
2013-09-04 7:13 ` Stefan Behrens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).