]> granicus.if.org Git - zfs/commitdiff
Illumos #3995
authorSaso Kiselkov <skiselkov.ml@gmail.com>
Mon, 14 Oct 2013 22:29:45 +0000 (18:29 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 5 Nov 2013 20:26:00 +0000 (12:26 -0800)
3995 Memory leak of compressed buffers in l2arc_write_done

References:
  https://illumos.org/issues/3995

Ported-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1688
Issue #1775

module/zfs/arc.c

index 5bba9a317e7d7b645783153035accafcb95dec3a..6aa7d37c7176335e64157894acbe2c08d0575625 100644 (file)
@@ -4487,6 +4487,13 @@ l2arc_write_done(zio_t *zio)
         */
        for (ab = list_prev(buflist, head); ab; ab = ab_prev) {
                ab_prev = list_prev(buflist, ab);
+               abl2 = ab->b_l2hdr;
+
+               /*
+                * Release the temporary compressed buffer as soon as possible.
+                */
+               if (abl2->b_compress != ZIO_COMPRESS_OFF)
+                       l2arc_release_cdata_buf(ab);
 
                hash_lock = HDR_LOCK(ab);
                if (!mutex_tryenter(hash_lock)) {
@@ -4499,14 +4506,6 @@ l2arc_write_done(zio_t *zio)
                        continue;
                }
 
-               abl2 = ab->b_l2hdr;
-
-               /*
-                * Release the temporary compressed buffer as soon as possible.
-                */
-               if (abl2->b_compress != ZIO_COMPRESS_OFF)
-                       l2arc_release_cdata_buf(ab);
-
                if (zio->io_error != 0) {
                        /*
                         * Error - drop L2ARC entry.