]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: dev-replace: go back to suspend state if another EXCL_OP is running
authorAnand Jain <anand.jain@oracle.com>
Sun, 11 Nov 2018 14:22:18 +0000 (22:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jan 2019 16:45:59 +0000 (17:45 +0100)
commit63ac0af6096cd2b1d8ec83e348ddbf3748a107dd
tree22994e946737d05308d29575fa0fd954fe1cadbc
parent658e75a7f0339a4a664e4693e415f675853b0235
btrfs: dev-replace: go back to suspend state if another EXCL_OP is running

commit 05c49e6bc1e8866ecfd674ebeeb58cdbff9145c2 upstream.

In a secnario where balance and replace co-exists as below,

  - start balance
  - pause balance
  - start replace
  - reboot

and when system restarts, balance resumes first. Then the replace is
attempted to restart but will fail as the EXCL_OP lock is already held
by the balance. If so place the replace state back to
BTRFS_IOCTL_DEV_REPLACE_STATE_SUSPENDED state.

Fixes: 010a47bde9420 ("btrfs: add proper safety check before resuming dev-replace")
CC: stable@vger.kernel.org # 4.18+
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