Skip to content

Commit

Permalink
ZIL: Change ZIOs issue order.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by:	Alexander Motin <[email protected]>
Sponsored by:	iXsystems, Inc.
Closes #15233
  • Loading branch information
amotin authored and behlendorf committed Sep 2, 2023
1 parent 7dc2baa commit 79ac1b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions module/zfs/zil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,10 +1924,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,
Expand Down

0 comments on commit 79ac1b2

Please sign in to comment.