HomeFreeBSD

Sync thread should avoid holding the spa config write lock when possible

Description

Sync thread should avoid holding the spa config write lock when possible

spa_sync() currently grabs the write lock due to an old hack that is
documented by a comment:

   We need the write lock here because, for aux vdevs,
   calling vdev_config_dirty() modifies sav_config.
   This is ugly and will become unnecessary when we
   eliminate the aux vdev wart by integrating all vdevs
   into the root vdev tree.

This has lead to deadlocks in rare edge cases from holding the write
lock. We can reduce incidence of these deadlocks by not grabbing the
write lock on pools without auxillary vdevs.

Sponsored-By: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@klarasystems.com>
Closes #14282

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Feb 16 2023, 10:10 PM
GitHub <noreply@github.com>Committed on Feb 16 2023, 10:10 PM
Parents
rGdc72c60ec11e: zfs redact fails when dnodesize=auto
Branches
Unknown
Tags
Unknown

Event Timeline

GitHub <noreply@github.com> committed rG9f08b6e31f7e: Sync thread should avoid holding the spa config write lock when possible (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Feb 16 2023, 10:10 PM