From e8122b7ecba6e8bc1d6e47fa8850b1f1e68cd7a8 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 1 Sep 2023 09:18:22 -0400 Subject: [PATCH] ZIL: Change ZIOs issue order. 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 parent to children should keep the lwb valid till the end, since the lwb can be freed only after lwb_root_zio completion callback. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- module/zfs/zil.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/zfs/zil.c b/module/zfs/zil.c index f2d279e36a96..3c0c1e043073 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1929,10 +1929,10 @@ zil_lwb_write_issue(zilog_t *zilog, lwb_t *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,