Skip to content

Commit

Permalink
MFV r260834:
Browse files Browse the repository at this point in the history
Fix memory leak of compressed buffers in l2arc_write_done (Illumos
#3995).
  • Loading branch information
delphij committed Jan 18, 2014
1 parent f2d92b6 commit 4b064bf
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright (c) 2013 by Saso Kiselkov. All rights reserved.
* Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
*/

Expand Down Expand Up @@ -4597,6 +4597,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)) {
Expand All @@ -4609,14 +4616,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.
Expand Down

0 comments on commit 4b064bf

Please sign in to comment.