From 423e7b62613d0a359e488cf2599a44174d073805 Mon Sep 17 00:00:00 2001 From: Andriy Gapon Date: Mon, 27 Feb 2017 14:47:33 -0800 Subject: [PATCH] OpenZFS 7867 - ARC space accounting leak Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Reviewed-by: George Melikov Reviewed-by: Giuseppe Di Natale Reviewed-by: Tim Chase Ported-by: Brian Behlendorf OpenZFS-issue: https://www.illumos.org/issues/7867 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/aa1f740d Closes #5874 --- module/zfs/arc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 9fac5a6c42cf..5764a63a4bef 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -2510,6 +2510,12 @@ arc_hdr_free_on_write(arc_buf_hdr_t *hdr) size, hdr); } (void) refcount_remove_many(&state->arcs_size, size, hdr); + if (type == ARC_BUFC_METADATA) { + arc_space_return(size, ARC_SPACE_META); + } else { + ASSERT(type == ARC_BUFC_DATA); + arc_space_return(size, ARC_SPACE_DATA); + } l2arc_free_abd_on_write(hdr->b_l1hdr.b_pabd, size, type); }