From dc56c673e3b0d206f1d3fca66fdf5f6a46dbc4b2 Mon Sep 17 00:00:00 2001 From: shodanshok Date: Fri, 28 Oct 2022 19:21:54 +0200 Subject: [PATCH] Fix ARC target collapse when zfs_arc_meta_limit_percent=100 Reclaim metadata when arc_available_memory < 0 even if meta_used is not bigger than arc_meta_limit. As described in https://github.com/openzfs/zfs/issues/14054 if zfs_arc_meta_limit_percent=100 then ARC target can collapse to arc_min due to arc_purge not freeing any metadata. This patch lets arc_prune to do its work when arc_available_memory is negative even if meta_used is not bigger than arc_meta_limit, avoiding ARC target collapse. Reviewed-by: Brian Behlendorf Signed-off-by: Gionatan Danti Closes #14054 Closes #14093 --- module/zfs/arc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 936bcb5e3..1f97631f9 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -4469,7 +4469,7 @@ restart: * meta buffers. Requests to the upper layers will be made with * increasingly large scan sizes until the ARC is below the limit. */ - if (meta_used > arc_meta_limit) { + if (meta_used > arc_meta_limit || arc_available_memory() < 0) { if (type == ARC_BUFC_DATA) { type = ARC_BUFC_METADATA; } else {