]> granicus.if.org Git - zfs/commitdiff
Add missing arc_free_cksum() to arc_release()
authorTom Caputi <tcaputi@datto.com>
Wed, 10 May 2017 17:25:27 +0000 (13:25 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 10 May 2017 17:25:27 +0000 (10:25 -0700)
The arc layer tracks checksums of its data in the arc header
so that it can ensure that buffers haven't changed when they're
not supposed to. This checksum is only maintained while there
is an uncompressed buffer still attached to the header.
Unfortunately there is a missing call to arc_free_cksum() in
arc_release() that can trigger ASSERTs. This has not been a
common issue because the checksums are only maintained for
debug builds and triggering the bug requires writing a block
(and therefore calling arc_release()) while a compressed buffer
is still being used on a debug build. This simply corrects the
issue.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #6105

module/zfs/arc.c

index acf98dd2dd8c349a729c3f65442aeabb7e963636..492a33a604ac0a75b0807d495e98f6fd1f017669 100644 (file)
@@ -5691,6 +5691,10 @@ arc_release(arc_buf_t *buf, void *tag)
                arc_cksum_verify(buf);
                arc_buf_unwatch(buf);
 
+               /* if this is the last uncompressed buf free the checksum */
+               if (!arc_hdr_has_uncompressed_buf(hdr))
+                       arc_cksum_free(hdr);
+
                mutex_exit(hash_lock);
 
                /*