X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Ftxg.c;h=5afb139ddfb0b87710bd2805326acf06ad0943a8;hb=691f6ac4c2858d64afc2a0dc1bd2b8c041d68502;hp=382a2a91c7b08b5a0c1dada5c3a0edf6cbadb15d;hpb=c28b227942b421ebdc03c9df9a012642fb517223;p=zfs.git diff --git a/module/zfs/txg.c b/module/zfs/txg.c index 382a2a9..5afb139 100644 --- a/module/zfs/txg.c +++ b/module/zfs/txg.c @@ -350,6 +350,20 @@ txg_dispatch_callbacks(dsl_pool_t *dp, uint64_t txg) } } +/* + * Wait for pending commit callbacks of already-synced transactions to finish + * processing. + * Calling this function from within a commit callback will deadlock. + */ +void +txg_wait_callbacks(dsl_pool_t *dp) +{ + tx_state_t *tx = &dp->dp_tx; + + if (tx->tx_commit_cb_taskq != NULL) + taskq_wait(tx->tx_commit_cb_taskq); +} + static void txg_sync_thread(dsl_pool_t *dp) { @@ -735,6 +749,7 @@ EXPORT_SYMBOL(txg_register_callbacks); EXPORT_SYMBOL(txg_delay); EXPORT_SYMBOL(txg_wait_synced); EXPORT_SYMBOL(txg_wait_open); +EXPORT_SYMBOL(txg_wait_callbacks); EXPORT_SYMBOL(txg_stalled); EXPORT_SYMBOL(txg_sync_waiting); #endif