mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11:00 +03:00
ZIL: Fix potential race on flush deferring.
zil_lwb_set_zio_dependency() can not set write ZIO dependency on previous LWB's write ZIO if one is already in done handler and set state to LWB_STATE_WRITE_DONE. So theoretically done handler of next LWB's write ZIO may run before done handler of previous LWB write ZIO completes. In such case we can not defer flushes, since the flush issue process is not locked. This may fix some reported assertions of lwb_vdev_tree not being empty inside zil_free_lwb(). Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Closes #15278
This commit is contained in:
parent
f7a07d76ee
commit
62677576a7
@ -1550,7 +1550,16 @@ zil_lwb_write_done(zio_t *zio)
|
||||
lwb->lwb_state = LWB_STATE_WRITE_DONE;
|
||||
lwb->lwb_child_zio = NULL;
|
||||
lwb->lwb_write_zio = NULL;
|
||||
|
||||
/*
|
||||
* If nlwb is not yet issued, zil_lwb_set_zio_dependency() is not
|
||||
* called for it yet, and when it will be, it won't be able to make
|
||||
* its write ZIO a parent this ZIO. In such case we can not defer
|
||||
* our flushes or below may be a race between the done callbacks.
|
||||
*/
|
||||
nlwb = list_next(&zilog->zl_lwb_list, lwb);
|
||||
if (nlwb && nlwb->lwb_state != LWB_STATE_ISSUED)
|
||||
nlwb = NULL;
|
||||
mutex_exit(&zilog->zl_lock);
|
||||
|
||||
if (avl_numnodes(t) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user