mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 19:34:43 +01:00
ddt prune: Add SCL_ZIO deadlock workaround
Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Allan Jude <[email protected]> Reviewed-by: Igor Kozhukhov <[email protected]> Signed-off-by: Igor Ostapenko <[email protected]> Closes #17793
This commit is contained in:
1 parent
01180a63bd
commit
b9d1e28a71
1 file changed
+23
-2
+23
-2
@@ -4574,8 +4574,29 @@ zio_vdev_io_start(zio_t *zio)
|
||||
ASSERT0(zio->io_child_error[ZIO_CHILD_VDEV]);
|
||||
|
||||
if (vd == NULL) {
|
||||
if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER))
|
||||
spa_config_enter(spa, SCL_ZIO, zio, RW_READER);
|
||||
if (!(zio->io_flags & ZIO_FLAG_CONFIG_WRITER)) {
|
||||
/*
|
||||
* A deadlock workaround. The ddt_prune_unique_entries()
|
||||
* -> prune_candidates_sync() code path takes the
|
||||
* SCL_ZIO reader lock and may request it again here.
|
||||
* If there is another thread who wants the SCL_ZIO
|
||||
* writer lock, then scl_write_wanted will be set.
|
||||
* Thus, the spa_config_enter_priority() is used to
|
||||
* ignore pending writer requests.
|
||||
*
|
||||
* The locking should be revised to remove the need
|
||||
* for this workaround. If that's not workable then
|
||||
* it should only be applied to the zios involved in
|
||||
* the pruning process. This impacts the read/write
|
||||
* I/O balance while pruning.
|
||||
*/
|
||||
if (spa->spa_active_ddt_prune)
|
||||
spa_config_enter_priority(spa, SCL_ZIO, zio,
|
||||
RW_READER);
|
||||
else
|
||||
spa_config_enter(spa, SCL_ZIO, zio,
|
||||
RW_READER);
|
||||
}
|
||||
|
||||
/*
|
||||
* The mirror_ops handle multiple DVAs in a single BP.
|
||||
|
||||
Reference in new issue
Block a user