btrfs: dev-replace: go back to suspended state if target device is missing
authorAnand Jain <anand.jain@oracle.com>
Sun, 11 Nov 2018 14:22:17 +0000 (22:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 16:38:45 +0000 (17:38 +0100)
commit28867a52e48d989a4c0f8476223a5d76918041f5
tree30061196d89b00678f28a2e802e95824d1c75dba
parent326ca6bd0fae2a164c47dcdd7f89a1da89f4cb11
btrfs: dev-replace: go back to suspended state if target device is missing

commit 0d228ece59a35a9b9e8ff0d40653234a6d90f61e upstream.

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 expect 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.

Fixes: e93c89c1aaaa ("Btrfs: add new sources for device replace code")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/dev-replace.c