]> git.hungrycats.org Git - linux/commitdiff
btrfs: dev-replace: do not warn when a resumed replace fails
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 16 Oct 2026 17:58:22 +0000 (13:58 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 2 Nov 2026 02:17:14 +0000 (21:17 -0500)
btrfs_dev_replace_kthread() continues a replace at mount time and warns
when btrfs_dev_replace_finishing() returns anything other than 0 or
-ECANCELED.  When the scrub fails, btrfs_dev_replace_finishing() cancels
the replace, logs "btrfs_scrub_dev(...) failed %d" and returns the scrub's
error, so the warning fires for ordinary replace failures that the ioctl
path just returns to userspace: -EROFS after a filesystem error, -ENOMEM,
and -EIO once write errors to the target stop the replace again.

The failure is already logged and recorded as a canceled replace.  Drop
the WARN_ON.

Assisted-by: Claude:claude-opus-5-5
fs/btrfs/dev-replace.c

index 68aaf39020a51bb3f8e5e2e759512c4799f27311..b19e6536ac3273d1e7346ec61b1cdbe408922a47 100644 (file)
@@ -1336,8 +1336,7 @@ static int btrfs_dev_replace_kthread(void *data)
                              dev_replace->committed_cursor_left,
                              btrfs_device_get_total_bytes(dev_replace->srcdev),
                              &dev_replace->scrub_progress, false, true);
-       ret = btrfs_dev_replace_finishing(fs_info, ret);
-       WARN_ON(ret && ret != -ECANCELED);
+       btrfs_dev_replace_finishing(fs_info, ret);
 
        btrfs_exclop_finish(fs_info);
        return 0;