Before I open an issue I would like to check the following observation with you.
It seems that in the case where arc_hdr_free_pdata() sees HDR_L2_WRITING() we
would fail to update the ARC space statistics.  In the normal case those
statistics are updated in arc_free_data_buf().  But in the
arc_hdr_free_on_write() path we don't do that.

I suggest the following patch to fix the problem.

--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
@@ -2652,6 +2652,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_data_on_write(hdr->b_l1hdr.b_pdata, size, type);
 }

Thanks!
-- 
Andriy Gapon


-------------------------------------------
openzfs-developer
Archives: https://www.listbox.com/member/archive/274414/=now
RSS Feed: https://www.listbox.com/member/archive/rss/274414/28015062-cce53afa
Modify Your Subscription: 
https://www.listbox.com/member/?member_id=28015062&id_secret=28015062-f966d51c
Powered by Listbox: http://www.listbox.com

Reply via email to