]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zil.c
ZIL: Second attempt to reduce scope of zl_issuer_lock.
authorAlexander Motin <mav@FreeBSD.org>
Fri, 25 Aug 2023 00:08:49 +0000 (20:08 -0400)
committerGitHub <noreply@github.com>
Fri, 25 Aug 2023 00:08:49 +0000 (17:08 -0700)
commiteda3fcd56ff9f46dd606c48331cb786856f37fe3
tree926dd2c96a321a80b8c176a249c7e2c7edb59c6b
parent11fbcacf37d1a66c7a40bb8920c70ce9a87270ea
ZIL: Second attempt to reduce scope of zl_issuer_lock.

The previous patch #14841 appeared to have significant flaw, causing
deadlocks if zl_get_data callback got blocked waiting for TXG sync.  I
already handled some of such cases in the original patch, but issue
 #14982 shown cases that were impossible to solve in that design.

This patch fixes the problem by postponing log blocks allocation till
the very end, just before the zios issue, leaving nothing blocking after
that point to cause deadlocks.  Before that point though any sleeps are
now allowed, not causing sync thread blockage.  This require slightly
more complicated lwb state machine to allocate blocks and issue zios
in proper order.  But with removal of special early issue workarounds
the new code is much cleaner now, and should even be more efficient.

Since this patch uses null zios between write, I've found that null
zios do not wait for logical children ready status in zio_ready(),
that makes parent write to proceed prematurely, producing incorrect
log blocks.  Added ZIO_CHILD_LOGICAL_BIT to zio_wait_for_children()
fixes it.

Reviewed-by: Rob Norris <rob.norris@klarasystems.com>
Reviewed-by: Mark Maybee <mark.maybee@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15122
cmd/ztest.c
include/sys/zil_impl.h
module/zfs/zfs_vnops.c
module/zfs/zil.c
module/zfs/zio.c
module/zfs/zvol.c