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
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;