]> git.proxmox.com Git - mirror_zfs.git/commit
ZIL: Fix config lock deadlock.
authorAlexander Motin <mav@FreeBSD.org>
Mon, 24 Jul 2023 20:41:11 +0000 (16:41 -0400)
committerGitHub <noreply@github.com>
Mon, 24 Jul 2023 20:41:11 +0000 (13:41 -0700)
commit2cb992a99ccadb78d97049b40bd442eb4fdc549d
tree715a68e9f93a731e2e0fc3a424662dc467c34742
parentfb344f5aeb7088238f9bd3c2a8507132b702cfed
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
module/zfs/zil.c