Skip to content

Commit 7e4351f

Browse files
amotinixhamza
authored andcommitted
ZIL: Force writing of open LWB on suspend
Under parallel workloads ZIL may delay writes of open LWBs that are not full enough. On suspend we do not expect anything new to appear since zil_get_commit_list() will not let it pass, only returning TXG number to wait for. But I suspect that waiting for the TXG commit without having the last LWB issued may not wait for its completion, resulting in panic described in openzfs#17509. Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Rob Norris <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#17521
1 parent 5132f8c commit 7e4351f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

module/zfs/zil.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,19 +2901,14 @@ zil_process_commit_list(zilog_t *zilog, zil_commit_waiter_t *zcw, list_t *ilwbs)
29012901

29022902
ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock));
29032903

2904-
/*
2905-
* Return if there's nothing to commit before we dirty the fs by
2906-
* calling zil_create().
2907-
*/
2908-
if (list_is_empty(&zilog->zl_itx_commit_list))
2909-
return;
2910-
2911-
list_create(&nolwb_itxs, sizeof (itx_t), offsetof(itx_t, itx_node));
2912-
list_create(&nolwb_waiters, sizeof (zil_commit_waiter_t),
2913-
offsetof(zil_commit_waiter_t, zcw_node));
2914-
29152904
lwb = list_tail(&zilog->zl_lwb_list);
29162905
if (lwb == NULL) {
2906+
/*
2907+
* Return if there's nothing to commit before we dirty the fs.
2908+
*/
2909+
if (list_is_empty(&zilog->zl_itx_commit_list))
2910+
return;
2911+
29172912
lwb = zil_create(zilog);
29182913
} else {
29192914
/*
@@ -2941,6 +2936,10 @@ zil_process_commit_list(zilog_t *zilog, zil_commit_waiter_t *zcw, list_t *ilwbs)
29412936
}
29422937
}
29432938

2939+
list_create(&nolwb_itxs, sizeof (itx_t), offsetof(itx_t, itx_node));
2940+
list_create(&nolwb_waiters, sizeof (zil_commit_waiter_t),
2941+
offsetof(zil_commit_waiter_t, zcw_node));
2942+
29442943
while ((itx = list_remove_head(&zilog->zl_itx_commit_list)) != NULL) {
29452944
lr_t *lrc = &itx->itx_lr;
29462945
uint64_t txg = lrc->lrc_txg;
@@ -3110,7 +3109,8 @@ zil_process_commit_list(zilog_t *zilog, zil_commit_waiter_t *zcw, list_t *ilwbs)
31103109
* possible, without significantly impacting the latency
31113110
* of each individual itx.
31123111
*/
3113-
if (lwb->lwb_state == LWB_STATE_OPENED && !zilog->zl_parallel) {
3112+
if (lwb->lwb_state == LWB_STATE_OPENED &&
3113+
(!zilog->zl_parallel || zilog->zl_suspend > 0)) {
31143114
zil_burst_done(zilog);
31153115
list_insert_tail(ilwbs, lwb);
31163116
lwb = zil_lwb_write_close(zilog, lwb, LWB_STATE_NEW);

0 commit comments

Comments
 (0)