Author: mav
Date: Mon Jan 22 04:23:48 2018
New Revision: 328246
URL: https://svnweb.freebsd.org/changeset/base/328246

Log:
  MFV r328245: 8856 arc_cksum_is_equal() doesn't take into account ABD-logic
  
  illumos/illumos-gate@01a059ee0cdece49f47fd4d70086dd5bc7d0b0ff
  
  https://www.illumos.org/issues/8856:
  arc_cksum_is_equal() calls zio_push_transform() that requires abd_t*
  (second arg), but a void* is passed.
  
  Reviewed by: Matthew Ahrens <mahr...@delphix.com>
  Reviewed by: George Wilson <george.wil...@delphix.com>
  Approved by: Gordon Ross <g...@nexenta.com>
  Author: Roman Strashkin <roman.strash...@nexenta.com>

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  head/sys/cddl/contrib/opensolaris/   (props changed)

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Jan 22 
04:21:55 2018        (r328245)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c   Mon Jan 22 
04:23:48 2018        (r328246)
@@ -23,7 +23,7 @@
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
  * Copyright (c) 2014 by Saso Kiselkov. All rights reserved.
- * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
@@ -1857,8 +1857,9 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio)
                uint64_t lsize = HDR_GET_LSIZE(hdr);
                uint64_t csize;
 
-               void *cbuf = zio_buf_alloc(HDR_GET_PSIZE(hdr));
-               csize = zio_compress_data(compress, zio->io_abd, cbuf, lsize);
+               abd_t *cdata = abd_alloc_linear(HDR_GET_PSIZE(hdr), B_TRUE);
+               csize = zio_compress_data(compress, zio->io_abd,
+                   abd_to_buf(cdata), lsize);
 
                ASSERT3U(csize, <=, HDR_GET_PSIZE(hdr));
                if (csize < HDR_GET_PSIZE(hdr)) {
@@ -1874,10 +1875,10 @@ arc_cksum_is_equal(arc_buf_hdr_t *hdr, zio_t *zio)
                         * and zero out any part that should not contain
                         * data.
                         */
-                       bzero((char *)cbuf + csize, HDR_GET_PSIZE(hdr) - csize);
+                       abd_zero_off(cdata, csize, HDR_GET_PSIZE(hdr) - csize);
                        csize = HDR_GET_PSIZE(hdr);
                }
-               zio_push_transform(zio, cbuf, csize, HDR_GET_PSIZE(hdr), NULL);
+               zio_push_transform(zio, cdata, csize, HDR_GET_PSIZE(hdr), NULL);
        }
 
        /*
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to