From 1d2b0563f731cf74d8e6cdecad559eb5fa1a3cd7 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 17193ed079..8bf5ce09aa 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -4460,7 +4460,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 {