]> git.proxmox.com Git - mirror_zfs.git/commitdiff
ZIL: Change ZIOs issue order.
authorAlexander Motin <mav@FreeBSD.org>
Sat, 2 Sep 2023 00:14:50 +0000 (20:14 -0400)
committerGitHub <noreply@github.com>
Sat, 2 Sep 2023 00:14:50 +0000 (17:14 -0700)
In zil_lwb_write_issue(), after issuing lwb_root_zio/lwb_write_zio,
we have no right to access lwb->lwb_child_zio. If it was not there,
the first two ZIOs may have already completed and freed the lwb.
ZIOs issue in opposite order from children to parent should keep
the lwb valid till the end, since the lwb can be freed only after
lwb_root_zio completion callback.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15233

module/zfs/zil.c

index 297c6b65d4f2af964bc7baabb47b6904a17ebd01..b30676b42d88097015732b95a29625bdb6d19c4b 100644 (file)
@@ -1924,10 +1924,10 @@ next_lwb:
                    BP_GET_LSIZE(&lwb->lwb_blk));
        }
        lwb->lwb_issued_timestamp = gethrtime();
-       zio_nowait(lwb->lwb_root_zio);
-       zio_nowait(lwb->lwb_write_zio);
        if (lwb->lwb_child_zio)
                zio_nowait(lwb->lwb_child_zio);
+       zio_nowait(lwb->lwb_write_zio);
+       zio_nowait(lwb->lwb_root_zio);
 
        /*
         * If nlwb was ready when we gave it the block pointer,