Skip to content

Commit 167b422

Browse files
robnspauka
authored andcommitted
zil_suspend: fix cookie leak if ZIL crashes during wait
Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes openzfs#17622
1 parent 8a8f24b commit 167b422

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

module/zfs/zil.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4485,16 +4485,16 @@ zil_suspend(const char *osname, void **cookiep)
44854485
cv_wait(&zilog->zl_cv_suspend, &zilog->zl_lock);
44864486
mutex_exit(&zilog->zl_lock);
44874487

4488-
if (cookiep == NULL)
4488+
if (zilog->zl_restart_txg > 0) {
4489+
/* ZIL crashed while we were waiting. */
4490+
zil_resume(os);
4491+
error = SET_ERROR(EBUSY);
4492+
} else if (cookiep == NULL)
44894493
zil_resume(os);
44904494
else
44914495
*cookiep = os;
44924496

4493-
if (zilog->zl_restart_txg > 0)
4494-
/* ZIL crashed while we were waiting. */
4495-
return (SET_ERROR(EBUSY));
4496-
4497-
return (0);
4497+
return (error);
44984498
}
44994499

45004500
/*

0 commit comments

Comments
 (0)