]> git.hungrycats.org Git - linux/commit
btrfs: dev-replace: count write errors to the target again
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 16 Oct 2026 08:07:34 +0000 (04:07 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Mon, 2 Nov 2026 02:17:14 +0000 (21:17 -0500)
commitb6e3e1799260f3bf5847e8e720b417cb883e02f9
tree50bf4cc449eafafcc08765d457a4baef8203de2a
parente8aa2c17d70fa680761bb9c476d0bea5549b8099
btrfs: dev-replace: count write errors to the target again

btrfs_dev_replace::num_write_errors is reported by the dev-replace status
ioctl, and scrub_enumerate_chunks() stops a replace with -EIO once it is
non-zero, so that a target that fails writes does not silently end up as
the new device.  Since the dev-replace writeback moved to the
scrub_stripe infrastructure nothing increments it: status always shows 0
write errors, and the abort never happens.

After the replace writes of a stripe have completed, add the sectors
whose write failed.  The stripe's write_error_bitmap also collects failed
repair writes to the source device, so clear it before the replace
writes are submitted.

Fixes: e02ee89baa66c ("btrfs: scrub: switch scrub_simple_mirror() to scrub_stripe infrastructure")
Assisted-by: Claude:claude-opus-5-5
fs/btrfs/scrub.c