mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
txg visibility code should not execute under tc_open_lock
The memory allocation and locking in `spa_txg_history_*()` can potentially block txg_hold_open for arbitrarily long periods of time. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #4333
This commit is contained in:
parent
fcf64f45d9
commit
f26b4b3c8a
@ -365,6 +365,7 @@ static void
|
|||||||
txg_quiesce(dsl_pool_t *dp, uint64_t txg)
|
txg_quiesce(dsl_pool_t *dp, uint64_t txg)
|
||||||
{
|
{
|
||||||
tx_state_t *tx = &dp->dp_tx;
|
tx_state_t *tx = &dp->dp_tx;
|
||||||
|
uint64_t tx_open_time;
|
||||||
int g = txg & TXG_MASK;
|
int g = txg & TXG_MASK;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
@ -376,10 +377,7 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg)
|
|||||||
|
|
||||||
ASSERT(txg == tx->tx_open_txg);
|
ASSERT(txg == tx->tx_open_txg);
|
||||||
tx->tx_open_txg++;
|
tx->tx_open_txg++;
|
||||||
tx->tx_open_time = gethrtime();
|
tx->tx_open_time = tx_open_time = gethrtime();
|
||||||
|
|
||||||
spa_txg_history_set(dp->dp_spa, txg, TXG_STATE_OPEN, tx->tx_open_time);
|
|
||||||
spa_txg_history_add(dp->dp_spa, tx->tx_open_txg, tx->tx_open_time);
|
|
||||||
|
|
||||||
DTRACE_PROBE2(txg__quiescing, dsl_pool_t *, dp, uint64_t, txg);
|
DTRACE_PROBE2(txg__quiescing, dsl_pool_t *, dp, uint64_t, txg);
|
||||||
DTRACE_PROBE2(txg__opened, dsl_pool_t *, dp, uint64_t, tx->tx_open_txg);
|
DTRACE_PROBE2(txg__opened, dsl_pool_t *, dp, uint64_t, tx->tx_open_txg);
|
||||||
@ -391,6 +389,9 @@ txg_quiesce(dsl_pool_t *dp, uint64_t txg)
|
|||||||
for (c = 0; c < max_ncpus; c++)
|
for (c = 0; c < max_ncpus; c++)
|
||||||
mutex_exit(&tx->tx_cpu[c].tc_open_lock);
|
mutex_exit(&tx->tx_cpu[c].tc_open_lock);
|
||||||
|
|
||||||
|
spa_txg_history_set(dp->dp_spa, txg, TXG_STATE_OPEN, tx_open_time);
|
||||||
|
spa_txg_history_add(dp->dp_spa, txg + 1, tx_open_time);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Quiesce the transaction group by waiting for everyone to txg_exit().
|
* Quiesce the transaction group by waiting for everyone to txg_exit().
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user