From c82de60a783dc150308f45b9d876566cce57cc2b Mon Sep 17 00:00:00 2001 From: seekfirstleapsecond <38333432+seekfirstleapsecond@users.noreply.github.com> Date: Mon, 7 Jan 2019 17:37:52 -0800 Subject: [PATCH] simplified logic Signed-off-by: Leap Second --- module/zfs/txg.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/module/zfs/txg.c b/module/zfs/txg.c index fc0cd85e0d..f7b1964442 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -550,19 +550,15 @@ txg_sync_thread(void *arg) txg_thread_wait(tx, &cpr, &tx->tx_quiesce_done_cv, 0); } + /* + * Wait until the quiesce thread has exited to ensure every + * quiesced txg has been synced before exiting. + */ if (tx->tx_exiting) { - if (checked_quiescing) { + while (tx->tx_threads != 1) + txg_thread_wait(tx, &cpr, &tx->tx_exit_cv, 0); + if (tx->tx_quiesced_txg == 0) txg_thread_exit(tx, &cpr, &tx->tx_sync_thread); - } else { - while (tx->tx_threads != 1) - txg_thread_wait(tx, &cpr, - &tx->tx_exit_cv, 0); - if (tx->tx_quiesced_txg) - checked_quiescing = B_TRUE; - else - txg_thread_exit(tx, &cpr, - &tx->tx_sync_thread); - } } /*