From 12f9a6a3f954b3bb8de94e3bfc072d42b7231abc Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 28 Apr 2014 13:56:47 -0700 Subject: [PATCH] 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 Signed-off-by: Ned Bass Closes #2287 --- module/zfs/arc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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)); } /*