HomeFreeBSD

fix l2arc compression buffers leak

Description

fix l2arc compression buffers leak

Commit log from FreeBSD:

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

References:

https://illumos.org/issues/5222
https://github.com/freebsd/freebsd/commit/b98f85d
http://thread.gmane.org/gmane.os.freebsd.current/155757/focus=155781
http://lists.open-zfs.org/pipermail/developer/2014-January/000455.html
http://lists.open-zfs.org/pipermail/developer/2014-February/000523.html

Ported-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3029

Details

Provenance
avgAuthored on Nov 6 2014, 11:08 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Feb 4 2015, 12:54 AM
Parents
rG19ea3d25df99: Use zio buffers in zil_itx_create()
Branches
Unknown
Tags
Unknown
Reverted By
rGf6b3b1f5d68a: Revert "fix l2arc compression buffers leak"