HomeFreeBSD

ZIL: Fix config lock deadlock.

Description

ZIL: Fix config lock deadlock.

When we have some LWBs closed and their ZIOs ready to be issued, we
can not afford sleeping on config lock if somebody else try to lock
it as writer, or it will cause a deadlock.

To solve it, move spa_config_enter() from zil_lwb_write_issue() to
zil_lwb_write_close() under zl_issuer_lock to enforce lock ordering
with other threads. Now if we can't immediately lock config, issue
all previously closed LWBs so that they could drop their config
locks after completion, and only then allow sleeping on our lock.

Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15078
Closes #15080

Details

Provenance
mavAuthored on Jul 24 2023, 8:41 PM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jul 25 2023, 8:54 PM
Parents
rGc79d1bae7537: Update changelog for OpenZFS 2.2.0 release
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG41a0f66279b1: ZIL: Fix config lock deadlock. (authored by mav).Jul 25 2023, 8:54 PM