]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: add info when mount fails due to stale replace target
authorAnand Jain <anand.jain@oracle.com>
Fri, 12 Aug 2022 10:32:19 +0000 (18:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 5 Sep 2022 08:27:43 +0000 (10:27 +0200)
commitd19af14c5e39be80a679f59a7742a6dd98c61621
tree4119abd9bb6fa285dff90bc738aeb08b1f113c5d
parent36ffede59267b623947f15b0473292eb05a4a7e6
btrfs: add info when mount fails due to stale replace target

commit 8460f54a3405d692bb422c5c8f2d52ce32fddf79 upstream.

If the replace target device reappears after the suspended replace is
cancelled, it blocks the mount operation as it can't find the matching
replace-item in the metadata. As shown below,

   BTRFS error (device sda5): replace devid present without an active replace item

To overcome this situation, the user can run the command

   btrfs device scan --forget <replace target device>

and try the mount command again. And also, to avoid repeating the issue,
superblock on the devid=0 must be wiped.

   wipefs -a device-path-to-devid=0.

This patch adds some info when this situation occurs.

Reported-by: Samuel Greiner <samuel@balkonien.org>
Link: https://lore.kernel.org/linux-btrfs/b4f62b10-b295-26ea-71f9-9a5c9299d42c@balkonien.org/T/
CC: stable@vger.kernel.org # 5.0+
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/dev-replace.c