Skip to content

sub-optimal mirror resilvering after zpool attach or replace #17471

Open
@avg-I

Description

@avg-I

System information

Type Version/Name
Distribution Name FreeBSD
Distribution Version 14-STABLE
Kernel Version 14.3-STABLE
Architecture amd64
OpenZFS Version zfs-kmod-2.2.7-FreeBSD_ge269af1b3

Describe the problem you're observing

Consider a pool with all top level vdevs being either single disks or mirrors.
Consider that some vdevs have been added some time (and some data) after the pool was originally created.

When we attach a disk to one of the newer top-level vdevs (either via zpool attach or zpool replace), ZFS initiates a resilver that involves all blocks that have even been written.
This is because spa_vdev_attach calls vdev_dtl_dirty(t = DTL_MISSING, txg = TXG_INITIAL).

It should be sufficient to pass txg equal to the top-level vdev's creation time vdev_crtxg as the vdev cannot have any blocks written before that.

The problem can be worked around to a degree using sequential reconstruction (e.g., zpool replace -s) but it would be nice to avoid extra work in either case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: DefectIncorrect behavior (e.g. crash, hang)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions