diff options
author | Brian Behlendorf <[email protected]> | 2014-04-28 13:56:47 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-05-01 12:08:53 -0700 |
commit | 12f9a6a3f954b3bb8de94e3bfc072d42b7231abc (patch) | |
tree | a4724ce09e36097bf3d7398edfb30496a3766459 /module | |
parent | 9d317793aa66d05a8c44410ea24a9a4166a89bbd (diff) |
dmu_tx_assign() should not return ENOMEM
As described in the comment above dmu_tx_assign() this function must
only fail if the pool is out of space. If for some other reason the
TX cannot be assigned (such as memory pressure) ERESTART must be
returned. Alternately, EAGAIN could be returned to inject a delay
but that isn't required because the caller will block on the condition
variable waiting for the next TXG.
/*
* Assign tx to a transaction group. txg_how can be one of:
*
* (1) TXG_WAIT. If the current open txg is full, waits until there's
* a new one. This should be used when you're not holding locks.
* It will only fail if we're truly out of space (or over quota).
* ...
*/
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ned Bass <[email protected]>
Closes #2287
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/arc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 518b82efa..387faaf8d 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -3986,9 +3986,14 @@ arc_tempreserve_space(uint64_t reserve, uint64_t txg) if (reserve > arc_c/4 && !arc_no_grow) arc_c = MIN(arc_c_max, reserve * 4); + + /* + * Throttle when the calculated memory footprint for the TXG + * exceeds the target ARC size. + */ if (reserve > arc_c) { DMU_TX_STAT_BUMP(dmu_tx_memory_reserve); - return (SET_ERROR(ENOMEM)); + return (SET_ERROR(ERESTART)); } /* |