Skip to content

Instantly share code, notes, and snippets.

@lundman
Created July 13, 2018 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lundman/5c269ae5582bac1adf2a58e7b9513c1b to your computer and use it in GitHub Desktop.
Save lundman/5c269ae5582bac1adf2a58e7b9513c1b to your computer and use it in GitHub Desktop.
Temporary kmem_cache_alloc work around
diff --git a/usr/src/uts/common/fs/zfs/arc.c b/usr/src/uts/common/fs/zfs/arc.c
index b2cc3bd..d714f60 100644
--- a/usr/src/uts/common/fs/zfs/arc.c
+++ b/usr/src/uts/common/fs/zfs/arc.c
@@ -3713,6 +3713,13 @@ arc_hdr_realloc_crypt(arc_buf_hdr_t *hdr, boolean_t need_crypt)
} else {
arc_hdr_clear_flags(nhdr, ARC_FLAG_PROTECTED);
}
+
+ // Due to lazy cons/dest in kmem_cache - clear it
+ hdr->b_l1hdr.b_acb = NULL;
+ hdr->b_l1hdr.b_pabd = NULL;
+ hdr->b_l1hdr.b_buf = NULL;
+ hdr->b_l1hdr.b_state = 0;
+
buf_discard_identity(hdr);
kmem_cache_free(ocache, hdr);
@GernotS
Copy link

GernotS commented Jul 13, 2018

you need to close the comment in line 10 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment