freebsd-skq/sys/cddl
avg b98f85d480 fix l2arc compression buffers leak
We have observed that arc_release() can be called concurrently with a
l2arc in-flight write.
Also, we have observed that arc_hdr_destroy() can be called from
arc_write_done() for a zio with ZIO_FLAG_IO_REWRITE flag in similar
circumstances.

Previously the l2arc headers would be freed while leaking their
associated compression buffers.  Now the buffers are placed on
l2arc_free_on_write list for delayed freeing.  This is similar to what
was already done to arc buffers that were supposed to be freed
concurrently with in-flight writes of those buffers.

In addition to fixing the discovered leaks this change also adds some
protective code to assert that a compression buffer associated with a
l2arc header is never leaked.

A new kstat l2_cdata_free_on_write is added.  It keeps a count of
delayed compression buffer frees which previously would have been leaks.

Tested by:	Vitalij Satanivskij <satan@ukr.net> et al
Requested by:	many
MFC after:	2 weeks
Sponsored by:	HybridCluster / ClusterHQ
2014-11-06 11:08:02 +00:00
..
boot/zfs Diff reduction with kernel code: instruct the compiler that the data of 2014-10-02 00:13:08 +00:00
compat/opensolaris This change addresses 4 bugs in ZFS exposed by Richard Kojedzinszky's 2014-10-25 17:42:44 +00:00
contrib/opensolaris fix l2arc compression buffers leak 2014-11-06 11:08:02 +00:00
dev Whitespace 2014-10-24 03:34:21 +00:00