6745678 zio->io_checksum == ZIO_CHECKSUM_SHA256_CCM_MAC (0x5 == 0x9), file: zio.c, line: 1498
authorDarren Moffat <Darren.Moffat@Sun.COM>
Mon, 08 Sep 2008 19:29:26 +0100
changeset 13371 45507bab8d65
parent 13370 01c762b436b5
child 13372 e8368bfba2f2
6745678 zio->io_checksum == ZIO_CHECKSUM_SHA256_CCM_MAC (0x5 == 0x9), file: zio.c, line: 1498
usr/src/uts/common/fs/zfs/zio.c
--- a/usr/src/uts/common/fs/zfs/zio.c	Mon Sep 08 16:05:52 2008 +0100
+++ b/usr/src/uts/common/fs/zfs/zio.c	Mon Sep 08 19:29:26 2008 +0100
@@ -1582,11 +1582,16 @@
 
 	ASSERT3U(crypt, !=, ZIO_CRYPT_OFF);
 	ASSERT3U(crypt, !=, ZIO_CRYPT_INHERIT);
-	ASSERT3U(BP_GET_CHECKSUM(bp), ==, ZIO_CHECKSUM_SHA256_CCM_MAC);
-	ASSERT3U(BP_GET_LEVEL(bp), ==, 0);
+	/*
+	 * These asserts are a problem for ZVOLS, remove them for now
+	 * but we should be able to assert at least the checksum case,
+	 * even for ZVOL, is problem that they didn't go through
+	 * the write_policy() call ?
+	 *
+	 * ASSERT3U(BP_GET_CHECKSUM(bp), ==, ZIO_CHECKSUM_SHA256_CCM_MAC);
+	 * ASSERT3U(BP_GET_LEVEL(bp), ==, 0);
+	 */
 	
-	zio_pop_transform(zio, &data, &size, &bufsize);
-
 	/* MAC is stored in the blkptr as the top two words of the checksum */
 	ASSERT3U(16, ==, zio_crypt_table[crypt].ci_maclen);
 	mac[0] = BE_64(bp->blk_cksum.zc_word[2]);
@@ -1605,6 +1610,8 @@
 		}
 	}
 
+	zio_pop_transform(zio, &data, &size, &bufsize);
+
 	if (zio->io_ckey != NULL) {
 		crypt_error = zio_decrypt_data(crypt, zio->io_ckey,
 		    &zio->io_bookmark, bp->blk_birth, isdnode,
@@ -1612,6 +1619,8 @@
 		zio_crypt_key_release(zio->io_ckey, FTAG);
 	}
 
+	zio_buf_free(data, bufsize);
+
 	/*
 	 * One possible failure is not having access to the
 	 * key material that the zboookmark_t says we needed,
@@ -1629,15 +1638,15 @@
 			 * clear text parts to be passed on.
 			 */
 			if (isdnode) {
-				printf("zio_read_decrypt: isdnode crypt_error = %d", crypt_error);
-				bcopy(data, zio->io_data, size);
+				DTRACE_PROBE2(zio__ciphertext__dnode, 
+				    blkptr_t *, bp, zbookmark_t *, 
+				    &zio->io_bookmark);
 				crypt_error = 0;
 			}
 		}
 		zio->io_error = crypt_error;
 	}
 
-	zio_buf_free(data, bufsize);
 	return (ZIO_PIPELINE_CONTINUE);
 }