mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
draid: fix cksum errors after rebuild with degraded disks
Currently, when more than nparity disks get faulted during the rebuild, only first nparity disks would go to faulted state, and all the remaining disks would go to degraded state. When a hot spare is attached to that degraded disk for rebuild creating the spare mirror, only that hot spare is getting rebuilt, but not the degraded device. So when later during scrub some other attached draid spare happens to map to that spare, it will end up with cksum error. Moreover, if the user clears the degraded disk from errors, the data won't be resilvered to it, hot spare will be detached almost immediately and the data that was resilvered only to it will be lost. Solution: write to all mirrored devices during rebuild, similar to traditional/healing resilvering, but only if we can verify the integrity of the data, or when it's the draid spare we are writing to, in which case we are writing to a reserved spare space, and there is no danger to overwrite any good data. The argument that writing only to rebuilding draid spare vdev is faster than writing to normal device doesn't hold since, at a specific offset being rebuilt, draid spare will be mapped to a normal device anyway. redundancy_draid_degraded2 automation test is added also to cover the scenario. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Andriy Tkachuk <atkachuk@wasabi.com> Closes #18414
This commit is contained in:
committed by
Tony Hutter
parent
eec8b9b929
commit
da44040bbb
@@ -669,23 +669,19 @@ vdev_mirror_io_start(zio_t *zio)
|
||||
}
|
||||
|
||||
while (children--) {
|
||||
mc = &mm->mm_child[c];
|
||||
c++;
|
||||
mc = &mm->mm_child[c++];
|
||||
|
||||
/*
|
||||
* When sequentially resilvering only issue write repair
|
||||
* IOs to the vdev which is being rebuilt for two reasons:
|
||||
* 1. The repair IO data calculated from parity has no checksum
|
||||
* to validate and could be incorrect. Existing data must
|
||||
* never be overwritten with unconfirmed data to ensure we
|
||||
* never lock in unrecoverable damage to the pool.
|
||||
* 2. Performance is limited by the slowest child device. We
|
||||
* don't want a slower device to limit the rebuild rate for
|
||||
* faster replacement devices such as distributed spares.
|
||||
* When sequentially resilvering and the integrity of the data
|
||||
* is speculative (ZIO_FLAG_SPECULATIVE), issue write repair IOs
|
||||
* only to the vdev which is being rebuilt. Existing data on
|
||||
* other children must never be overwritten with unconfirmed
|
||||
* data to avoid unrecoverable damage to the pool.
|
||||
*/
|
||||
if ((zio->io_priority == ZIO_PRIORITY_REBUILD) &&
|
||||
(zio->io_flags & ZIO_FLAG_IO_REPAIR) &&
|
||||
!(zio->io_flags & ZIO_FLAG_SCRUB) &&
|
||||
(zio->io_flags & ZIO_FLAG_SPECULATIVE) &&
|
||||
mm->mm_rebuilding && !mc->mc_rebuilding) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user