[PATCH 2/9] btrfs: replace go back to suspended if target missing
At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and suppose the target device is missing, then let the replace state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 59991165e126..3c29b0976087 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -884,6 +884,8 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info) "cannot continue dev_replace, tgtdev is missing"); btrfs_info(fs_info, "you may cancel the operation after 'mount -o degraded'"); + dev_replace->replace_state = + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; btrfs_dev_replace_write_unlock(dev_replace); return 0; } -- 1.8.3.1
Re: [PATCH 2/9] btrfs: replace go back to suspended if target missing
On 11/07/2018 08:35 PM, Nikolay Borisov wrote: On 7.11.18 г. 13:43 ч., Anand Jain wrote: At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and suppose the target device is missing, then let the replace state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 59991165e126..47d6768a9cde 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -884,6 +884,9 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info) "cannot continue dev_replace, tgtdev is missing"); btrfs_info(fs_info, "you may cancel the operation after 'mount -o degraded'"); + dev_replace->replace_state = + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; + dev_replace->item_needs_writeback = 1; Why do we need items_needs_writeback = 1 here, nothing is changed w.r.t on-disk data? You are right. We don't need writeback. Will fix. Thanks, Anand btrfs_dev_replace_write_unlock(dev_replace); return 0; }
Re: [PATCH 2/9] btrfs: replace go back to suspended if target missing
On 7.11.18 г. 13:43 ч., Anand Jain wrote: > At the time of forced unmount we place the running replace to > BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes > back and suppose the target device is missing, then let the replace > state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state > instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any > matching scrub running as part of replace. > > Signed-off-by: Anand Jain > --- > fs/btrfs/dev-replace.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c > index 59991165e126..47d6768a9cde 100644 > --- a/fs/btrfs/dev-replace.c > +++ b/fs/btrfs/dev-replace.c > @@ -884,6 +884,9 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info > *fs_info) > "cannot continue dev_replace, tgtdev is missing"); > btrfs_info(fs_info, > "you may cancel the operation after 'mount -o > degraded'"); > + dev_replace->replace_state = > + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; > + dev_replace->item_needs_writeback = 1; Why do we need items_needs_writeback = 1 here, nothing is changed w.r.t on-disk data? > btrfs_dev_replace_write_unlock(dev_replace); > return 0; > } >
[PATCH 2/9] btrfs: replace go back to suspended if target missing
At the time of forced unmount we place the running replace to BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state, so when the system comes back and suppose the target device is missing, then let the replace state continue to be in BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state instead of BTRFS_IOCTL_DEV_REPLACE_STATE_STARTED as there isn't any matching scrub running as part of replace. Signed-off-by: Anand Jain --- fs/btrfs/dev-replace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 59991165e126..47d6768a9cde 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -884,6 +884,9 @@ int btrfs_resume_dev_replace_async(struct btrfs_fs_info *fs_info) "cannot continue dev_replace, tgtdev is missing"); btrfs_info(fs_info, "you may cancel the operation after 'mount -o degraded'"); + dev_replace->replace_state = + BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED; + dev_replace->item_needs_writeback = 1; btrfs_dev_replace_write_unlock(dev_replace); return 0; } -- 1.8.3.1