Darren J Moffat
2006-May-17 11:40 UTC
[zfs-crypto-discuss] spa_sync assert failure vdec_config_sync
I''m getting the following assertion failure when using my zfs-crypto bits: panic[cpu0]/thread=2a100c8dcc0: assertion failed: vdev_config_sync(rvd, txg) == 0, file: ../../common/fs/zfs/spa.c, line: 2149 000002a100c8d890 genunix:assfail+7c (7ae6e9c8, 7ae6e9e8, 865, 1853c00, 12b4000, 0) %l0-3: 0000000070212458 00000600009d3680 00000600009d3810 0000000000000000 %l4-7: 0000000000000081 0000000000000000 0000000001899000 0000000000000000 000002a100c8d940 zfs:spa_sync+1dc (600009d3680, 151, 6000119edc0, 6000119edc0, 7ae59800, 7ae6e800) %l0-3: 00000600009d3810 00000600009d37d8 0000030027c8c168 0000030027c8c138 %l4-7: 0000030027fe50c0 00000600009d3848 0000030027c8c000 0000000070212000 000002a100c8d9f0 zfs:txg_sync_thread+1a4 (30027c8c000, 151, 2a100c8dab0, 30027c8c120, 30027c8c112, 30027c8c110) %l0-3: 0000000000000000 0000030027c8c0d0 0000030027c8c0d8 0000030027c8c116 %l4-7: 0000030027c8c114 0000030027c8c0c8 0000000070212094 000000007ae59f78 These are a slightly updated version of what I posted on the project website for being in sync with onnv_40. For those internal to Sun you can see the webrev here: http://borg.sfbay/cube/projects/zfs-crypto/webrev/ The dump for those internal is on mix.sfbay in the usual place (dump number 8). For those external sorry you''ll need to live with the attached diff output just now. I came to the conclusion that I needed to change the on disk version number for crypto since older releases would panic if they saw the crypt flag turned on in the blkptr_t. The above panic came seconds after zpool upgrade had said it was complete. I must be missing something silly any help much appreciated. -- Darren J Moffat -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: diffs.current URL: <http://mail.opensolaris.org/pipermail/zfs-crypto-discuss/attachments/20060517/99ab04e7/attachment.ksh>
Eric Schrock
2006-May-17 16:18 UTC
[zfs-crypto-discuss] Re: [zfs-code] spa_sync assert failure vdec_config_sync
This looks like: 6413847 vdev label write failure should be handled more gracefully Which suggests that you have a bad device. Indeed, if you look at the output of ''::spa -ve''[1] you''ll see: 0000030027fe50c0 HEALTHY - root READ WRITE FREE CLAIM IOCTL OPS 0 0 0 0 0 BYTES 0 0 0 0 0 EREAD 0 EWRITE 0 ECKSUM 0 00000600009d4700 HEALTHY - /dev/dsk/c1t1d0s0 READ WRITE FREE CLAIM IOCTL OPS 0x8 0x30 0 0 0 BYTES 0xbc000 0x1b400 0 0 0 EREAD 0 EWRITE 0x1 ECKSUM 0 As you can see ''EWRITE'' for c1t1d0s0 is non-zero. However, I don''t see anything in /var/adm/messages to indicate that there is an underlying hardware problem. Does this happen every time? I''ll take a look at your code to see if there''s any reason why a label I/O would be failing. - Eric [1] Actually, ''spa -v'' is currently broken but fixed in one of my workspaces. You can get the same behavior with: ::walk spa | ::print spa_t spa_root_vdev | ::vdev -re On Wed, May 17, 2006 at 12:40:30PM +0100, Darren J Moffat wrote:> I''m getting the following assertion failure when using my zfs-crypto > bits: > > panic[cpu0]/thread=2a100c8dcc0: assertion failed: vdev_config_sync(rvd, > txg) == 0, file: ../../common/fs/zfs/spa.c, line: 2149 > > 000002a100c8d890 genunix:assfail+7c (7ae6e9c8, 7ae6e9e8, 865, 1853c00, > 12b4000, 0) > %l0-3: 0000000070212458 00000600009d3680 00000600009d3810 > 0000000000000000 > %l4-7: 0000000000000081 0000000000000000 0000000001899000 > 0000000000000000 > 000002a100c8d940 zfs:spa_sync+1dc (600009d3680, 151, 6000119edc0, > 6000119edc0, 7ae59800, 7ae6e800) > %l0-3: 00000600009d3810 00000600009d37d8 0000030027c8c168 > 0000030027c8c138 > %l4-7: 0000030027fe50c0 00000600009d3848 0000030027c8c000 > 0000000070212000 > 000002a100c8d9f0 zfs:txg_sync_thread+1a4 (30027c8c000, 151, 2a100c8dab0, > 30027c8c120, 30027c8c112, 30027c8c110) > %l0-3: 0000000000000000 0000030027c8c0d0 0000030027c8c0d8 > 0000030027c8c116 > %l4-7: 0000030027c8c114 0000030027c8c0c8 0000000070212094 > 000000007ae59f78 > > These are a slightly updated version of what I posted on the project > website for being in sync with onnv_40. For those internal to Sun you > can see the webrev here: > http://borg.sfbay/cube/projects/zfs-crypto/webrev/ > > The dump for those internal is on mix.sfbay in the usual place (dump > number 8). > > For those external sorry you''ll need to live with the attached diff > output just now. > > I came to the conclusion that I needed to change the on disk version > number for crypto since older releases would panic if they saw the crypt > flag turned on in the blkptr_t. The above panic came seconds after > zpool upgrade had said it was complete. > > I must be missing something silly any help much appreciated. > > > -- > Darren J Moffat> > ------- usr/src/cmd/zdb/zdb.c ------- > > Index: usr/src/cmd/zdb/zdb.c > --- /ws/onnv-clone/usr/src/cmd/zdb/zdb.c Mon May 1 23:03:51 2006 > +++ /cube/projects/zfs-crypto/usr/src/cmd/zdb/zdb.c Fri May 12 07:00:25 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)zdb.c 1.12 06/04/29 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <stdio.h> > #include <stdio_ext.h> > @@ -51,6 +51,7 @@ > #include <sys/dmu_traverse.h> > #include <sys/zio_checksum.h> > #include <sys/zio_compress.h> > +#include <sys/zio_crypt.h> > > const char cmdname[] = "zdb"; > uint8_t dump_opt[256]; > @@ -972,6 +973,10 @@ > (void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)", > zio_compress_table[doi.doi_compress].ci_name); > > + if (doi.doi_crypt != ZIO_CRYPT_INHERIT || verbosity >= 6) > + (void) snprintf(aux + strlen(aux), sizeof (aux), " (E=%s)", > + zio_crypt_table[doi.doi_crypt].ci_name); > + > (void) printf("%10lld %3u %5s %5s %5s %5s %s%s\n", > (u_longlong_t)object, doi.doi_indirection, iblk, dblk, lsize, > asize, dmu_ot[doi.doi_type].ot_name, aux); > > ------- usr/src/cmd/zpool/zpool_main.c ------- > > Index: usr/src/cmd/zpool/zpool_main.c > --- /ws/onnv-clone/usr/src/cmd/zpool/zpool_main.c Mon Apr 10 23:04:14 2006 > +++ /cube/projects/zfs-crypto/usr/src/cmd/zpool/zpool_main.c Wed May 17 04:26:44 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)zpool_main.c 1.12 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <assert.h> > #include <ctype.h> > @@ -2852,6 +2852,7 @@ > (void) printf(gettext(" 1 Initial ZFS version.\n")); > (void) printf(gettext(" 2 Ditto blocks " > "(replicated metadata)\n")); > + (void) printf(gettext(" 3 Initial Cryptographic support.\n")); > (void) printf(gettext("\nFor more information on a particular " > "version, including supported releases, see:\n\n")); > (void) printf("http://www.opensolaris.org/os/community/zfs/" > > ------- usr/src/common/zfs/zfs_prop.c ------- > > Index: usr/src/common/zfs/zfs_prop.c > --- /ws/onnv-clone/usr/src/common/zfs/zfs_prop.c Fri Mar 17 23:03:47 2006 > +++ /cube/projects/zfs-crypto/usr/src/common/zfs/zfs_prop.c Mon Apr 3 05:15:17 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)zfs_prop.c 1.8 06/03/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > /* > * Master property table. > @@ -124,6 +124,9 @@ > { "compression", prop_type_index, ZIO_COMPRESS_DEFAULT, "off", > prop_inherit, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, > "on | off | lzjb", "COMPRESS", "%8s" }, > + { "encryption", prop_type_index, ZIO_CRYPT_DEFAULT, "off", > + prop_inherit, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, > + "on | off | aes128 | aes192 | aes256", "CRYPT", "%8s" }, > { "atime", prop_type_boolean, 1, NULL, prop_inherit, > ZFS_TYPE_FILESYSTEM, > "on | off", "ATIME", "%5s" }, > > ------- usr/src/lib/libzfs/common/libzfs_dataset.c ------- > > Index: usr/src/lib/libzfs/common/libzfs_dataset.c > --- /ws/onnv-clone/usr/src/lib/libzfs/common/libzfs_dataset.c Tue Apr 11 23:04:01 2006 > +++ /cube/projects/zfs-crypto/usr/src/lib/libzfs/common/libzfs_dataset.c Mon Apr 24 04:55:51 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)libzfs_dataset.c 1.17 06/04/11 SMI" > +#pragma ident "@(#)libzfs_dataset.c 1.18 06/04/24 SMI" > > #include <assert.h> > #include <ctype.h> > @@ -410,6 +410,18 @@ > struct { > const char *name; > uint64_t value; > +} crypt_table[] = { > + { "on", ZIO_CRYPT_ON }, > + { "off", ZIO_CRYPT_OFF }, > + { "aes128", ZIO_CRYPT_AES_128 }, > + { "aes192", ZIO_CRYPT_AES_192 }, > + { "aes256", ZIO_CRYPT_AES_256 }, > + { NULL } > +}; > + > +struct { > + const char *name; > + uint64_t value; > } snapdir_table[] = { > { "hidden", ZFS_SNAPDIR_HIDDEN }, > { "visible", ZFS_SNAPDIR_VISIBLE }, > @@ -696,6 +708,24 @@ > } > break; > > + case ZFS_PROP_ENCRYPTION: > + for (i = 0; crypt_table[i].name != NULL; i++) { > + if (strcmp(value, crypt_table[i].name) > + == 0) { > + number = crypt_table[i].value; > + break; > + } > + } > + > + if (crypt_table[i].name == NULL) { > + zfs_error(dgettext(TEXT_DOMAIN, > + "bad %s value ''%s'': must be ''on'', ''off'', " > + "''aes128'', ''aes192'', or ''aes256''"), > + propname, value); > + return (-1); > + } > + break; > + > case ZFS_PROP_SNAPDIR: > for (i = 0; snapdir_table[i].name != NULL; i++) { > if (strcmp(value, snapdir_table[i].name) == 0) { > @@ -1213,6 +1243,7 @@ > > case ZFS_PROP_RECORDSIZE: > case ZFS_PROP_COMPRESSION: > + case ZFS_PROP_ENCRYPTION: > case ZFS_PROP_ZONED: > val = getprop_uint64(zhp, prop, source); > return (val); > @@ -1416,6 +1447,16 @@ > (void) strlcpy(propbuf, compress_table[i].name, proplen); > break; > > + case ZFS_PROP_ENCRYPTION: > + val = getprop_uint64(zhp, prop, &source); > + for (i = 0; crypt_table[i].name != NULL; i++) { > + if (crypt_table[i].value == val) > + break; > + } > + assert(crypt_table[i].name != NULL); > + (void) strlcpy(propbuf, crypt_table[i].name, proplen); > + break; > + > case ZFS_PROP_CHECKSUM: > val = getprop_uint64(zhp, prop, &source); > for (i = 0; checksum_table[i].name != NULL; i++) { > > ------- usr/src/lib/libzfs_jni/common/libzfs_jni_property.c ------- > > Index: usr/src/lib/libzfs_jni/common/libzfs_jni_property.c > --- /ws/onnv-clone/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c Mon Jan 30 23:04:00 2006 > +++ /cube/projects/zfs-crypto/usr/src/lib/libzfs_jni/common/libzfs_jni_property.c Thu Feb 9 08:26:25 2006 > @@ -24,7 +24,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)libzfs_jni_property.c 1.4 06/01/29 SMI" > +#pragma ident "@(#)libzfs_jni_property.c 1.5 06/02/09 SMI" > > #include "libzfs_jni_property.h" > #include "libzfs_jni_util.h" > @@ -75,6 +75,7 @@ > static jobject str_to_aclmode(JNIEnv *, char *); > static jobject str_to_checksum(JNIEnv *, char *); > static jobject str_to_compression(JNIEnv *, char *); > +static jobject str_to_crypt(JNIEnv *, char *); > static jobject str_to_snapdir(JNIEnv *, char *); > static jobject str_to_string(JNIEnv *, char *); > > @@ -127,6 +128,10 @@ > ZFSJNI_PACKAGE_DATA "CompressionProperty", > ZFSJNI_PACKAGE_DATA "CompressionProperty$Compression" }, > > + { ZFS_PROP_ENCRYPTION, str_to_crypt, NULL, > + ZFSJNI_PACKAGE_DATA "EncryptionProperty", > + ZFSJNI_PACKAGE_DATA "EncryptionProperty$Encryption" }, > + > { ZFS_PROP_COMPRESSRATIO, NULL, zjni_long_to_Long, > ZFSJNI_PACKAGE_DATA "CompressRatioProperty", > "java/lang/Long" }, > @@ -480,6 +485,13 @@ > ZFSJNI_PACKAGE_DATA "CompressionProperty$Compression")); > } > > +static jobject > +str_to_crypt(JNIEnv *env, char *str) > +{ > + return (str_to_enum_element(env, str, > + ZFSJNI_PACKAGE_DATA "EncryptionProperty$Encryption")); > +} > + > static jobject > str_to_snapdir(JNIEnv *env, char *str) > { > > ------- usr/src/uts/common/Makefile.files ------- > > Index: usr/src/uts/common/Makefile.files > --- /ws/onnv-clone/usr/src/uts/common/Makefile.files Sun Apr 23 23:06:54 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/Makefile.files Mon Apr 24 08:28:25 2006 > @@ -23,7 +23,7 @@ > # Copyright 2006 Sun Microsystems, Inc. All rights reserved. > # Use is subject to license terms. > # > -# ident "@(#)Makefile.files 1.470 06/04/22 SMI" > +# ident "%Z%%M% %I% %E% SMI" > # > # This Makefile defines all file modules for the directory uts/common > # and its children. These are the source files which may be considered > @@ -886,6 +886,7 @@ > zio.o \ > zio_checksum.o \ > zio_compress.o \ > + zio_crypt.o \ > zio_inject.o > > ZFS_SHARED_OBJS += \ > > ------- usr/src/uts/common/fs/zfs/arc.c ------- > > Index: usr/src/uts/common/fs/zfs/arc.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/arc.c Tue May 16 23:02:05 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/arc.c Tue May 9 03:15:38 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)arc.c 1.11 06/05/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > /* > * DVA-based Adjustable Relpacement Cache > @@ -2194,8 +2194,8 @@ > } > > int > -arc_write(zio_t *pio, spa_t *spa, int checksum, int compress, int ncopies, > - uint64_t txg, blkptr_t *bp, arc_buf_t *buf, > +arc_write(zio_t *pio, spa_t *spa, int checksum, int compress, > + int encrypt, int ncopies, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, > arc_done_func_t *done, void *private, int priority, int flags, > uint32_t arc_flags, zbookmark_t *zb) > { > @@ -2213,8 +2213,9 @@ > acb->acb_byteswap = (arc_byteswap_func_t *)-1; > hdr->b_acb = acb; > hdr->b_flags |= ARC_IO_IN_PROGRESS; > - rzio = zio_write(pio, spa, checksum, compress, ncopies, txg, bp, > - buf->b_data, hdr->b_size, arc_write_done, buf, priority, flags, zb); > + rzio = zio_write(pio, spa, checksum, compress, encrypt, > + ncopies, txg, bp, buf->b_data, hdr->b_size, > + arc_write_done, buf, priority, flags, zb); > > if (arc_flags & ARC_WAIT) > return (zio_wait(rzio)); > @@ -2246,8 +2247,7 @@ > */ > ASSERT(bp->blk_cksum.zc_word[0] == 0 || > ab->b_cksum0 == bp->blk_cksum.zc_word[0]); > - if (ab->b_state != arc.anon) > - arc_change_state(arc.anon, ab, hash_lock); > + arc_change_state(arc.anon, ab, hash_lock); > if (refcount_is_zero(&ab->b_refcnt)) { > mutex_exit(hash_lock); > arc_hdr_destroy(ab); > > ------- usr/src/uts/common/fs/zfs/dbuf.c ------- > > Index: usr/src/uts/common/fs/zfs/dbuf.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/dbuf.c Mon Apr 17 23:38:47 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/dbuf.c Fri Apr 28 05:30:56 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)dbuf.c 1.10 06/04/17 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/dmu.h> > @@ -1721,7 +1721,7 @@ > dnode_t *dn = db->db_dnode; > objset_impl_t *os = dn->dn_objset; > int epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT; > - int checksum, compress; > + int checksum, compress, crypt; > zbookmark_t zb; > int blksz; > > @@ -1997,6 +1997,7 @@ > */ > checksum = ZIO_CHECKSUM_FLETCHER_4; > compress = ZIO_COMPRESS_LZJB; > + crypt = ZIO_CRYPT_DEFAULT; > } else { > /* > * Allow dnode settings to override objset settings, > @@ -2006,11 +2007,14 @@ > checksum = os->os_md_checksum; > compress = zio_compress_select(dn->dn_compress, > os->os_md_compress); > + crypt = zio_crypt_select(dn->dn_crypt, os->os_crypt); > } else { > checksum = zio_checksum_select(dn->dn_checksum, > os->os_checksum); > compress = zio_compress_select(dn->dn_compress, > os->os_compress); > + crypt = zio_crypt_select(dn->dn_crypt, > + os->os_crypt); > } > } > #ifdef ZFS_DEBUG > @@ -2029,7 +2033,7 @@ > zb.zb_level = db->db_level; > zb.zb_blkid = db->db_blkid; > > - (void) arc_write(zio, os->os_spa, checksum, compress, > + (void) arc_write(zio, os->os_spa, checksum, compress, crypt, > dmu_get_replication_level(os->os_spa, &zb, dn->dn_type), txg, > db->db_blkptr, *data, dbuf_write_done, db, > ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, ARC_NOWAIT, &zb); > > ------- usr/src/uts/common/fs/zfs/dmu.c ------- > > Index: usr/src/uts/common/fs/zfs/dmu.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/dmu.c Mon Apr 10 23:04:16 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/dmu.c Fri May 12 06:45:13 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)dmu.c 1.6 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/dmu.h> > #include <sys/dmu_impl.h> > @@ -1526,6 +1526,7 @@ > err = arc_write(NULL, osi->os_spa, > zio_checksum_select(db->db_dnode->dn_checksum, osi->os_checksum), > zio_compress_select(db->db_dnode->dn_compress, osi->os_compress), > + zio_crypt_select(db->db_dnode->dn_crypt, osi->os_crypt), > dmu_get_replication_level(osi->os_spa, &zb, db->db_dnode->dn_type), > txg, blk, db->db_d.db_data_old[txg&TXG_MASK], NULL, NULL, > ZIO_PRIORITY_SYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, ARC_WAIT, &zb); > @@ -1686,6 +1687,7 @@ > doi->doi_indirection = dn->dn_nlevels; > doi->doi_checksum = dn->dn_checksum; > doi->doi_compress = dn->dn_compress; > + doi->doi_crypt = dn->dn_crypt; > doi->doi_physical_blks = dn->dn_phys->dn_secphys; > doi->doi_max_block_offset = dn->dn_phys->dn_maxblkid; > doi->doi_type = dn->dn_type; > > ------- usr/src/uts/common/fs/zfs/dmu_objset.c ------- > > Index: usr/src/uts/common/fs/zfs/dmu_objset.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/dmu_objset.c Thu Apr 13 23:05:09 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/dmu_objset.c Fri Apr 28 09:28:13 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)dmu_objset.c 1.8 06/04/13 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/dmu_objset.h> > @@ -115,6 +115,19 @@ > osi->os_compress = zio_compress_select(newval, ZIO_COMPRESS_ON_VALUE); > } > > +static void > +crypt_changed_cb(void *arg, uint64_t newval) > +{ > + objset_impl_t *osi = arg; > + > + /* > + * Inheritance and range checking should have been done by now. > + */ > + ASSERT(newval != ZIO_CRYPT_INHERIT); > + > + osi->os_crypt = zio_crypt_select(newval, ZIO_CRYPT_ON_VALUE); > +} > + > void > dmu_objset_byteswap(void *buf, size_t size) > { > @@ -172,6 +185,9 @@ > if (err == 0) > err = dsl_prop_register(ds, "compression", > compression_changed_cb, osi); > + if (err == 0) > + err = dsl_prop_register(ds, "encryption", > + crypt_changed_cb, osi); > if (err) { > zio_buf_free(osi->os_phys, sizeof (objset_phys_t)); > kmem_free(osi, sizeof (objset_impl_t)); > @@ -178,9 +194,14 @@ > return (err); > } > } else { > - /* It''s the meta-objset. */ > + /* > + * It''s the meta-objset. > + * Encryption is off for ZFS metadata but on for ZPL metadata > + * and file/zvol contents. > + */ > osi->os_checksum = ZIO_CHECKSUM_FLETCHER_4; > osi->os_compress = ZIO_COMPRESS_LZJB; > + osi->os_crypt = ZIO_CRYPT_OFF; > } > > osi->os_zil = zil_alloc(&osi->os, &osi->os_phys->os_zil_header); > @@ -200,6 +221,11 @@ > osi->os_md_checksum = ZIO_CHECKSUM_FLETCHER_4; > osi->os_md_compress = ZIO_COMPRESS_LZJB; > > +#if 0 > + /* XXX darrenm Force crypto on for now */ > + osi->os_crypt = ??? > +#endif > + > for (i = 0; i < TXG_SIZE; i++) { > list_create(&osi->os_dirty_dnodes[i], sizeof (dnode_t), > offsetof(dnode_t, dn_dirty_link[i])); > @@ -344,6 +370,11 @@ > err = dsl_prop_unregister(ds, "compression", > compression_changed_cb, osi); > ASSERT(err == 0); > +#if 0 > + err = dsl_prop_unregister(ds, "encryption", > + crypt_changed_cb, osi); > + ASSERT(err == 0); > +#endif > } > > /* > @@ -672,6 +703,7 @@ > > /* > * Sync the root block. > + * The root block is unencrypted. > */ > bcopy(os->os_phys, abuf->b_data, sizeof (objset_phys_t)); > zb.zb_objset = os->os_dsl_dataset ? os->os_dsl_dataset->ds_object : 0; > @@ -679,7 +711,7 @@ > zb.zb_level = -1; > zb.zb_blkid = 0; > err = arc_write(NULL, os->os_spa, os->os_md_checksum, > - os->os_md_compress, > + os->os_md_compress, ZIO_CRYPT_OFF, > dmu_get_replication_level(os->os_spa, &zb, DMU_OT_OBJSET), > tx->tx_txg, &os->os_rootbp, abuf, killer, os, > ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, ARC_WAIT, &zb); > > ------- usr/src/uts/common/fs/zfs/dnode.c ------- > > Index: usr/src/uts/common/fs/zfs/dnode.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/dnode.c Tue May 16 23:02:05 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/dnode.c Mon Apr 24 05:35:10 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)dnode.c 1.10 06/05/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/dbuf.h> > @@ -184,6 +184,7 @@ > dnp->dn_bonustype = BSWAP_8(dnp->dn_bonustype); > dnp->dn_checksum = BSWAP_8(dnp->dn_checksum); > dnp->dn_compress = BSWAP_8(dnp->dn_compress); > + dnp->dn_crypt = BSWAP_8(dnp->dn_crypt); > dnp->dn_datablkszsec = BSWAP_16(dnp->dn_datablkszsec); > dnp->dn_bonuslen = BSWAP_16(dnp->dn_bonuslen); > dnp->dn_maxblkid = BSWAP_64(dnp->dn_maxblkid); > @@ -279,6 +280,7 @@ > dn->dn_nblkptr = dnp->dn_nblkptr; > dn->dn_checksum = dnp->dn_checksum; > dn->dn_compress = dnp->dn_compress; > + dn->dn_crypt = dnp->dn_crypt; > dn->dn_bonustype = dnp->dn_bonustype; > dn->dn_bonuslen = dnp->dn_bonuslen; > dn->dn_maxblkid = dnp->dn_maxblkid; > @@ -371,6 +373,7 @@ > dn->dn_bonuslen = bonuslen; > dn->dn_checksum = ZIO_CHECKSUM_INHERIT; > dn->dn_compress = ZIO_COMPRESS_INHERIT; > + dn->dn_crypt = ZIO_CRYPT_INHERIT; > dn->dn_dirtyctx = 0; > > dn->dn_free_txg = 0; > @@ -442,7 +445,6 @@ > rw_exit(&dn->dn_struct_rwlock); > if (refcount_add(&db->db_holds, FTAG) == 1) > dnode_add_ref(dn, db); > - VERIFY(0 == dbuf_read(db, NULL, DB_RF_MUST_SUCCEED)); > mutex_enter(&db->db_mtx); > ASSERT3U(db->db.db_size, ==, dn->dn_bonuslen); > ASSERT(db->db.db_data != NULL); > @@ -459,6 +461,7 @@ > dn->dn_nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); > dn->dn_checksum = ZIO_CHECKSUM_INHERIT; > dn->dn_compress = ZIO_COMPRESS_INHERIT; > + dn->dn_crypt = ZIO_CRYPT_INHERIT; > ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); > > dn->dn_allocated_txg = tx->tx_txg; > > ------- usr/src/uts/common/fs/zfs/dnode_sync.c ------- > > Index: usr/src/uts/common/fs/zfs/dnode_sync.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/dnode_sync.c Mon Mar 20 23:03:56 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/dnode_sync.c Mon Apr 3 05:15:21 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)dnode_sync.c 1.10 06/03/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/dbuf.h> > @@ -560,6 +560,7 @@ > */ > dnp->dn_checksum = dn->dn_checksum; > dnp->dn_compress = dn->dn_compress; > + dnp->dn_crypt = dn->dn_crypt; > > mutex_exit(&dn->dn_mtx); > > > ------- usr/src/uts/common/fs/zfs/spa_misc.c ------- > > Index: usr/src/uts/common/fs/zfs/spa_misc.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/spa_misc.c Thu Apr 13 23:05:09 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/spa_misc.c Tue Apr 25 02:34:10 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)spa_misc.c 1.8 06/04/13 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/spa_impl.h> > @@ -30,6 +30,7 @@ > #include <sys/zio.h> > #include <sys/zio_checksum.h> > #include <sys/zio_compress.h> > +#include <sys/zio_crypt.h> > #include <sys/dmu.h> > #include <sys/dmu_tx.h> > #include <sys/zap.h> > @@ -646,9 +647,10 @@ > } > > (void) snprintf(buf + strlen(buf), len - strlen(buf), > - "%s %s %s %s birth=%llu fill=%llu cksum=%llx:%llx:%llx:%llx", > + "%s %s %s %s %s birth=%llu fill=%llu cksum=%llx:%llx:%llx:%llx", > zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name, > zio_compress_table[BP_GET_COMPRESS(bp)].ci_name, > + zio_crypt_table[BP_GET_CRYPT(bp)].ci_name, > BP_GET_BYTEORDER(bp) == 0 ? "BE" : "LE", > BP_IS_GANG(bp) ? "gang" : "contiguous", > (u_longlong_t)bp->blk_birth, > > ------- usr/src/uts/common/fs/zfs/sys/arc.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/arc.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/arc.h Mon Apr 10 23:04:12 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/arc.h Mon Apr 24 05:35:11 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_ARC_H > #define _SYS_ARC_H > > -#pragma ident "@(#)arc.h 1.3 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > > @@ -75,8 +75,8 @@ > int arc_read(zio_t *pio, spa_t *spa, blkptr_t *bp, arc_byteswap_func_t *swap, > arc_done_func_t *done, void *private, int priority, int flags, > uint32_t arc_flags, zbookmark_t *zb); > -int arc_write(zio_t *pio, spa_t *spa, int checksum, int compress, int ncopies, > - uint64_t txg, blkptr_t *bp, arc_buf_t *buf, > +int arc_write(zio_t *pio, spa_t *spa, int checksum, int compress, int encrypt, > + int ncopies, uint64_t txg, blkptr_t *bp, arc_buf_t *buf, > arc_done_func_t *done, void *private, int priority, int flags, > uint32_t arc_flags, zbookmark_t *zb); > int arc_free(zio_t *pio, spa_t *spa, uint64_t txg, blkptr_t *bp, > > ------- usr/src/uts/common/fs/zfs/sys/dmu.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/dmu.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/dmu.h Mon Apr 10 23:04:12 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/dmu.h Fri May 12 06:48:58 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_DMU_H > #define _SYS_DMU_H > > -#pragma ident "@(#)dmu.h 1.9 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > /* > * This file describes the interface that the DMU provides for its > @@ -433,6 +433,7 @@ > uint8_t doi_indirection; /* 2 = dnode->indirect->data */ > uint8_t doi_checksum; > uint8_t doi_compress; > + uint8_t doi_crypt; > uint8_t doi_pad[5]; > /* Values below are number of 512-byte blocks. */ > uint64_t doi_physical_blks; /* data + metadata */ > > ------- usr/src/uts/common/fs/zfs/sys/dmu_objset.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/dmu_objset.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/dmu_objset.h Mon Mar 20 23:03:55 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/dmu_objset.h Mon Apr 3 05:15:23 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_DMU_OBJSET_H > #define _SYS_DMU_OBJSET_H > > -#pragma ident "@(#)dmu_objset.h 1.3 06/03/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/spa.h> > #include <sys/txg.h> > @@ -66,6 +66,7 @@ > objset_t os; > uint8_t os_checksum; /* can change, under dsl_dir''s locks */ > uint8_t os_compress; /* can change, under dsl_dir''s locks */ > + uint8_t os_crypt; /* can change, under dsl_dir''s locks */ > uint8_t os_md_checksum; > uint8_t os_md_compress; > > > ------- usr/src/uts/common/fs/zfs/sys/dnode.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/dnode.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/dnode.h Mon Mar 20 23:03:55 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/dnode.h Mon Apr 3 05:15:23 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_DNODE_H > #define _SYS_DNODE_H > > -#pragma ident "@(#)dnode.h 1.5 06/03/16 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/avl.h> > @@ -95,7 +95,7 @@ > uint8_t dn_bonustype; /* type of data in bonus buffer */ > uint8_t dn_checksum; /* ZIO_CHECKSUM type */ > uint8_t dn_compress; /* ZIO_COMPRESS type */ > - uint8_t dn_pad1[1]; > + uint8_t dn_crypt; /* ZIO_CRYPT type */ > uint16_t dn_datablkszsec; /* data block size in 512b sectors */ > uint16_t dn_bonuslen; /* length of dn_bonus */ > uint8_t dn_pad2[4]; > @@ -141,6 +141,7 @@ > uint8_t dn_nblkptr; /* number of blkptrs (immutable) */ > uint8_t dn_checksum; /* ZIO_CHECKSUM type */ > uint8_t dn_compress; /* ZIO_COMPRESS type */ > + uint8_t dn_crypt; /* ZIO_CRYPT type */ > uint8_t dn_nlevels; > uint8_t dn_indblkshift; > uint8_t dn_datablkshift; /* zero if blksz not power of 2! */ > > ------- usr/src/uts/common/fs/zfs/sys/spa.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/spa.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/spa.h Thu Apr 13 23:05:06 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/spa.h Mon Apr 24 05:35:12 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_SPA_H > #define _SYS_SPA_H > > -#pragma ident "@(#)spa.h 1.8 06/04/13 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/avl.h> > #include <sys/zfs_context.h> > @@ -172,8 +172,8 @@ > */ > typedef struct blkptr { > dva_t blk_dva[3]; /* 128-bit Data Virtual Address */ > - uint64_t blk_prop; /* size, compression, type, etc */ > - uint64_t blk_pad[3]; /* Extra space for the future */ > + uint64_t blk_prop[2]; /* size, compression, type, etc */ > + uint64_t blk_pad[2]; /* Extra space for the future */ > uint64_t blk_birth; /* transaction group at birth */ > uint64_t blk_fill; /* fill count */ > zio_cksum_t blk_cksum; /* 256-bit checksum */ > @@ -206,30 +206,33 @@ > > #define BP_GET_LSIZE(bp) \ > (BP_IS_HOLE(bp) ? 0 : \ > - BF64_GET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1)) > + BF64_GET_SB((bp)->blk_prop[0], 0, 16, SPA_MINBLOCKSHIFT, 1)) > #define BP_SET_LSIZE(bp, x) \ > - BF64_SET_SB((bp)->blk_prop, 0, 16, SPA_MINBLOCKSHIFT, 1, x) > + BF64_SET_SB((bp)->blk_prop[0], 0, 16, SPA_MINBLOCKSHIFT, 1, x) > > #define BP_GET_PSIZE(bp) \ > - BF64_GET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1) > + BF64_GET_SB((bp)->blk_prop[0], 16, 16, SPA_MINBLOCKSHIFT, 1) > #define BP_SET_PSIZE(bp, x) \ > - BF64_SET_SB((bp)->blk_prop, 16, 16, SPA_MINBLOCKSHIFT, 1, x) > + BF64_SET_SB((bp)->blk_prop[0], 16, 16, SPA_MINBLOCKSHIFT, 1, x) > > -#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop, 32, 8) > -#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop, 32, 8, x) > +#define BP_GET_COMPRESS(bp) BF64_GET((bp)->blk_prop[0], 32, 8) > +#define BP_SET_COMPRESS(bp, x) BF64_SET((bp)->blk_prop[0], 32, 8, x) > > -#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop, 40, 8) > -#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop, 40, 8, x) > +#define BP_GET_CHECKSUM(bp) BF64_GET((bp)->blk_prop[0], 40, 8) > +#define BP_SET_CHECKSUM(bp, x) BF64_SET((bp)->blk_prop[0], 40, 8, x) > > -#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop, 48, 8) > -#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop, 48, 8, x) > +#define BP_GET_TYPE(bp) BF64_GET((bp)->blk_prop[0], 48, 8) > +#define BP_SET_TYPE(bp, x) BF64_SET((bp)->blk_prop[0], 48, 8, x) > > -#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop, 56, 5) > -#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop, 56, 5, x) > +#define BP_GET_LEVEL(bp) BF64_GET((bp)->blk_prop[0], 56, 5) > +#define BP_SET_LEVEL(bp, x) BF64_SET((bp)->blk_prop[0], 56, 5, x) > > -#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop, 63, 1)) > -#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop, 63, 1, x) > +#define BP_GET_BYTEORDER(bp) (0 - BF64_GET((bp)->blk_prop[0], 63, 1)) > +#define BP_SET_BYTEORDER(bp, x) BF64_SET((bp)->blk_prop[0], 63, 1, x) > > +#define BP_GET_CRYPT(bp) BF64_GET((bp)->blk_prop[1], 0, 8) > +#define BP_SET_CRYPT(bp, x) BF64_SET((bp)->blk_prop[1], 0, 8, x) > + > #define BP_GET_ASIZE(bp) \ > (DVA_GET_ASIZE(&(bp)->blk_dva[0]) + DVA_GET_ASIZE(&(bp)->blk_dva[1]) + \ > DVA_GET_ASIZE(&(bp)->blk_dva[2])) > @@ -270,10 +273,10 @@ > (bp)->blk_dva[1].dva_word[1] = 0; \ > (bp)->blk_dva[2].dva_word[0] = 0; \ > (bp)->blk_dva[2].dva_word[1] = 0; \ > - (bp)->blk_prop = 0; \ > + (bp)->blk_prop[0] = 0; \ > + (bp)->blk_prop[1] = 0; \ > (bp)->blk_pad[0] = 0; \ > (bp)->blk_pad[1] = 0; \ > - (bp)->blk_pad[2] = 0; \ > (bp)->blk_birth = 0; \ > (bp)->blk_fill = 0; \ > ZIO_SET_CHECKSUM(&(bp)->blk_cksum, 0, 0, 0, 0); \ > > ------- usr/src/uts/common/fs/zfs/sys/zio.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/zio.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/zio.h Thu Apr 13 23:05:06 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/zio.h Tue May 2 07:22:04 2006 > @@ -26,7 +26,7 @@ > #ifndef _ZIO_H > #define _ZIO_H > > -#pragma ident "@(#)zio.h 1.5 06/04/13 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/spa.h> > @@ -96,6 +96,19 @@ > #define ZIO_COMPRESS_ON_VALUE ZIO_COMPRESS_LZJB > #define ZIO_COMPRESS_DEFAULT ZIO_COMPRESS_OFF > > +enum zio_encrypt { > + ZIO_CRYPT_INHERIT = 0, > + ZIO_CRYPT_ON, > + ZIO_CRYPT_OFF, > + ZIO_CRYPT_AES_128, > + ZIO_CRYPT_AES_192, > + ZIO_CRYPT_AES_256, > + ZIO_CRYPT_FUNCTIONS > +}; > + > +#define ZIO_CRYPT_ON_VALUE ZIO_CRYPT_AES_128 > +#define ZIO_CRYPT_DEFAULT ZIO_CRYPT_OFF > + > #define ZIO_PRIORITY_NOW (zio_priority_table[0]) > #define ZIO_PRIORITY_SYNC_READ (zio_priority_table[1]) > #define ZIO_PRIORITY_SYNC_WRITE (zio_priority_table[2]) > @@ -193,6 +206,7 @@ > zbookmark_t io_bookmark; > enum zio_checksum io_checksum; > enum zio_compress io_compress; > + enum zio_encrypt io_crypt; > int io_ndvas; > uint64_t io_txg; > blkptr_t *io_bp; > @@ -258,11 +272,11 @@ > int priority, int flags, zbookmark_t *zb); > > extern zio_t *zio_write(zio_t *pio, spa_t *spa, int checksum, int compress, > - int ncopies, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > + int encrypt, int ncopies, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > zio_done_func_t *done, void *private, int priority, int flags, > zbookmark_t *zb); > > -extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, int checksum, > +extern zio_t *zio_rewrite(zio_t *pio, spa_t *spa, int checksum, int crypt, > uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > zio_done_func_t *done, void *private, int priority, int flags, > zbookmark_t *zb); > @@ -318,6 +332,7 @@ > > extern uint8_t zio_checksum_select(uint8_t child, uint8_t parent); > extern uint8_t zio_compress_select(uint8_t child, uint8_t parent); > +extern uint8_t zio_crypt_select(uint8_t child, uint8_t parent); > > boolean_t zio_should_retry(zio_t *zio); > > > ------- usr/src/uts/common/fs/zfs/sys/zio_crypt.h ------- > > --- /dev/null Wed May 17 04:30:04 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/zio_crypt.h Tue May 16 07:00:26 2006 > @@ -1,0 +1,58 @@ > +/* > + * CDDL HEADER START > + * > + * The contents of this file are subject to the terms of the > + * Common Development and Distribution License (the "License"). > + * You may not use this file except in compliance with the License. > + * > + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE > + * or http://www.opensolaris.org/os/licensing. > + * See the License for the specific language governing permissions > + * and limitations under the License. > + * > + * When distributing Covered Code, include this CDDL HEADER in each > + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. > + * If applicable, add the following below this CDDL HEADER, with the > + * fields enclosed by brackets "[]" replaced with your own identifying > + * information: Portions Copyright [yyyy] [name of copyright owner] > + * > + * CDDL HEADER END > + */ > + > +/* > + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +#ifndef _SYS_ZIO_CRYPT_H > +#define _SYS_ZIO_CRYPT_H > +#pragma ident "%Z%%M% %I% %E% SMI" > + > +#include <sys/zio.h> > +#include <sys/crypto/api.h> > + > +#ifdef __cplusplus > +extern "C" { > +#endif > + > +typedef struct zio_crypt_info { > + crypto_mech_name_t ci_mechanism; > + size_t ci_keylen; > + char *ci_name; > +} zio_crypt_info_t; > + > + > +extern zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS]; > + > +extern void zio_encrypt_data(int crypt, zbookmark_t bookmark, uint64_t iv, > + void *data, uint64_t datasize, int *error); > + > +extern void zio_decrypt_data(int crypt, zbookmark_t bookmark, > + void *data, uint64_t datasize, int *error); > + > + > +#ifdef __cplusplus > +} > +#endif > + > +#endif /* _SYS_ZIO_CRYPT_H */ > > ------- usr/src/uts/common/fs/zfs/sys/zio_impl.h ------- > > Index: usr/src/uts/common/fs/zfs/sys/zio_impl.h > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/sys/zio_impl.h Mon Apr 10 23:04:12 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/sys/zio_impl.h Fri May 12 06:33:40 2006 > @@ -26,7 +26,7 @@ > #ifndef _ZIO_IMPL_H > #define _ZIO_IMPL_H > > -#pragma ident "@(#)zio_impl.h 1.3 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/zio.h> > @@ -44,6 +44,7 @@ > ZIO_STAGE_WAIT_CHILDREN_READY, /* RWFCI */ > > ZIO_STAGE_WRITE_COMPRESS, /* -W--- */ > + ZIO_STAGE_WRITE_ENCRYPT, /* -W---*/ > ZIO_STAGE_CHECKSUM_GENERATE, /* -W--- */ > > ZIO_STAGE_GANG_PIPELINE, /* -WFC- */ > @@ -69,6 +70,7 @@ > > ZIO_STAGE_CHECKSUM_VERIFY, /* R---- */ > ZIO_STAGE_READ_GANG_MEMBERS, /* R---- */ > + ZIO_STAGE_READ_DECRYPT, /* R---- */ > ZIO_STAGE_READ_DECOMPRESS, /* R---- */ > > ZIO_STAGE_DONE /* RWFCI */ > @@ -82,6 +84,8 @@ > ((1U << ZIO_STAGE_CHECKSUM_GENERATE) | \ > (1U << ZIO_STAGE_VDEV_IO_DONE) | \ > (1U << ZIO_STAGE_CHECKSUM_VERIFY) | \ > + (1U << ZIO_STAGE_READ_DECRYPT) | \ > + (1U << ZIO_STAGE_WRITE_ENCRYPT) | \ > (1U << ZIO_STAGE_READ_DECOMPRESS)) > > #define ZIO_VDEV_IO_PIPELINE \ > @@ -104,6 +108,7 @@ > #define ZIO_WRITE_PHYS_PIPELINE \ > ((1U << ZIO_STAGE_OPEN) | \ > (1U << ZIO_STAGE_WAIT_CHILDREN_READY) | \ > + (1U << ZIO_STAGE_WRITE_ENCRYPT) | \ > (1U << ZIO_STAGE_CHECKSUM_GENERATE) | \ > (1U << ZIO_STAGE_READY) | \ > ZIO_VDEV_IO_PIPELINE | \ > > ------- usr/src/uts/common/fs/zfs/zil.c ------- > > Index: usr/src/uts/common/fs/zfs/zil.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/zil.c Wed Apr 19 23:04:05 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/zil.c Tue May 2 07:27:02 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)zil.c 1.9 06/04/18 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/spa.h> > @@ -710,7 +710,14 @@ > zb.zb_level = -1; > zb.zb_blkid = lwb->lwb_blk.blk_cksum.zc_word[ZIL_ZC_SEQ]; > > - zio_nowait(zio_rewrite(NULL, spa, ZIO_CHECKSUM_ZILOG, 0, > + /* > + * XXX darrenm - encryption in ZIL ? > + * We might need to do this but need to find out if there is any > + * user data or POSIX fs meta data in ZIL or if it is all just ZFS > + * stuff. Could be important for traffic analsyis. > + * Note to darrenm: Learn more about ZIL > + */ > + zio_nowait(zio_rewrite(NULL, spa, ZIO_CHECKSUM_ZILOG, ZIO_CRYPT_OFF, 0, > &lwb->lwb_blk, lwb->lwb_buf, lwb->lwb_sz, zil_lwb_write_done, lwb, > ZIO_PRIORITY_LOG_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb)); > > > ------- usr/src/uts/common/fs/zfs/zio.c ------- > > Index: usr/src/uts/common/fs/zfs/zio.c > --- /ws/onnv-clone/usr/src/uts/common/fs/zfs/zio.c Thu Apr 13 23:05:10 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/zio.c Tue May 16 09:31:56 2006 > @@ -23,7 +23,7 @@ > * Use is subject to license terms. > */ > > -#pragma ident "@(#)zio.c 1.7 06/04/13 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/zfs_context.h> > #include <sys/fm/fs/zfs.h> > @@ -33,6 +33,7 @@ > #include <sys/vdev_impl.h> > #include <sys/zio_impl.h> > #include <sys/zio_compress.h> > +#include <sys/zio_crypt.h> > #include <sys/zio_checksum.h> > > /* > @@ -343,8 +344,8 @@ > } > > zio_t * > -zio_write(zio_t *pio, spa_t *spa, int checksum, int compress, int ncopies, > - uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > +zio_write(zio_t *pio, spa_t *spa, int checksum, int compress, int crypt, > + int ncopies, uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > zio_done_func_t *done, void *private, int priority, int flags, > zbookmark_t *zb) > { > @@ -356,6 +357,9 @@ > ASSERT(compress >= ZIO_COMPRESS_OFF && > compress < ZIO_COMPRESS_FUNCTIONS); > > + ASSERT(crypt >= ZIO_CRYPT_OFF && > + crypt < ZIO_CRYPT_FUNCTIONS); > + > zio = zio_create(pio, spa, txg, bp, data, size, done, private, > ZIO_TYPE_WRITE, priority, flags, > ZIO_STAGE_OPEN, ZIO_WRITE_PIPELINE); > @@ -367,6 +371,7 @@ > zio->io_checksum = checksum; > zio->io_compress = compress; > zio->io_ndvas = ncopies; > + zio->io_crypt = crypt; > > if (compress != ZIO_COMPRESS_OFF) > zio->io_async_stages |= 1U << ZIO_STAGE_WRITE_COMPRESS; > @@ -386,7 +391,7 @@ > } > > zio_t * > -zio_rewrite(zio_t *pio, spa_t *spa, int checksum, > +zio_rewrite(zio_t *pio, spa_t *spa, int checksum, int crypt, > uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > zio_done_func_t *done, void *private, int priority, int flags, > zbookmark_t *zb) > @@ -400,6 +405,7 @@ > zio->io_bookmark = *zb; > zio->io_checksum = checksum; > zio->io_compress = ZIO_COMPRESS_OFF; > + zio->io_crypt = crypt; > > if (pio != NULL) > ASSERT3U(zio->io_ndvas, <=, BP_GET_NDVAS(bp)); > @@ -408,7 +414,7 @@ > } > > static zio_t * > -zio_write_allocate(zio_t *pio, spa_t *spa, int checksum, > +zio_write_allocate(zio_t *pio, spa_t *spa, int checksum, int crypt, > uint64_t txg, blkptr_t *bp, void *data, uint64_t size, > zio_done_func_t *done, void *private, int priority, int flags) > { > @@ -425,6 +431,7 @@ > > zio->io_checksum = checksum; > zio->io_compress = ZIO_COMPRESS_OFF; > + zio->io_crypt = crypt; > > return (zio); > } > @@ -527,6 +534,7 @@ > > BP_SET_CHECKSUM(bp, checksum); > BP_SET_COMPRESS(bp, ZIO_COMPRESS_OFF); > + BP_SET_CRYPT(bp, ZIO_CRYPT_OFF); /* XXX darrenm */ > BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER); > > if (checksum != ZIO_CHECKSUM_OFF) > @@ -745,7 +753,6 @@ > if (bp != NULL) { > ASSERT(bp->blk_pad[0] == 0); > ASSERT(bp->blk_pad[1] == 0); > - ASSERT(bp->blk_pad[2] == 0); > ASSERT(bcmp(bp, &zio->io_bp_copy, sizeof (blkptr_t)) == 0); > if (zio->io_type == ZIO_TYPE_WRITE && !BP_IS_HOLE(bp) && > !(zio->io_flags & ZIO_FLAG_IO_REPAIR)) { > @@ -940,8 +947,70 @@ > zio_next_stage(zio); > } > > + > /* > * =========================================================================> + * Cryptographic support > + * =========================================================================> + */ > + > +static void > +zio_write_encrypt(zio_t *zio) > +{ > + blkptr_t *bp = zio->io_bp; > + int crypt = zio->io_crypt; > + int crypt_error; > + > + if (crypt == ZIO_CRYPT_OFF) { > + zio_next_stage(zio); > + return; > + } > + > + /* > + * We pass in the zbookmark_t so we can lookup which key > + * is needed. > + * We also pass on the birth time of the block for use as > + * a 64bit IV in crypto algorithms that need one. > + */ > + zio_encrypt_data(crypt, zio->io_bookmark, zio->io_bp->blk_birth, > + zio->io_data, zio->io_size, &crypt_error); > + > + /* XXX > + * Need to work out how to deal with failures here. > + * One possible failure is not having access to the > + * key material that the zboookmark_t says we needed, > + * that might be EAGAIN. > + */ > + if (crypt_error != 0) > + zio->io_error = crypt_error; > + > + zio_next_stage(zio); > +} > + > +static void > +zio_read_decrypt(zio_t *zio) > +{ > + blkptr_t *bp = zio->io_bp; > + int crypt = BP_GET_CRYPT(bp); > + int crypt_error; > + > + if (crypt == ZIO_CRYPT_OFF) { > + zio_next_stage(zio); > + return; > + } > + > + zio_decrypt_data(crypt, zio->io_bookmark, zio->io_data, > + zio->io_size, &crypt_error); > + > + if (crypt_error != 0) > + zio->io_error = crypt_error; > + > + zio_next_stage(zio); > + return; > +} > + > +/* > + * =========================================================================> * Gang block support > * =========================================================================> */ > @@ -1044,7 +1113,8 @@ > ASSERT(!BP_IS_HOLE(gbp)); > > zio_nowait(zio_rewrite(zio, zio->io_spa, zio->io_checksum, > - zio->io_txg, gbp, (char *)zio->io_data + loff, lsize, > + zio->io_crypt, zio->io_txg, gbp, > + (char *)zio->io_data + loff, lsize, > NULL, NULL, zio->io_priority, zio->io_flags, > &zio->io_bookmark)); > } > @@ -1189,7 +1259,7 @@ > BP_SET_COMPRESS(gbp, ZIO_COMPRESS_OFF); > gbp->blk_birth = txg; > zio_nowait(zio_rewrite(zio, spa, > - zio->io_checksum, txg, gbp, > + zio->io_checksum, zio->io_crypt, txg, gbp, > (char *)zio->io_data + loff, lsize, > zio_write_allocate_gang_member_done, NULL, > zio->io_priority, zio->io_flags, > @@ -1198,7 +1268,7 @@ > lsize = P2ROUNDUP(resid / gbps_left, SPA_MINBLOCKSIZE); > ASSERT(lsize != SPA_MINBLOCKSIZE); > zio_nowait(zio_write_allocate(zio, spa, > - zio->io_checksum, txg, gbp, > + zio->io_checksum, zio->io_crypt, txg, gbp, > (char *)zio->io_data + loff, lsize, > zio_write_allocate_gang_member_done, NULL, > zio->io_priority, zio->io_flags)); > @@ -1549,6 +1619,7 @@ > zio_badop, > zio_wait_children_ready, > zio_write_compress, > + zio_write_encrypt, > zio_checksum_generate, > zio_gang_pipeline, > zio_get_gang_header, > @@ -1566,6 +1637,7 @@ > zio_wait_children_done, > zio_checksum_verify, > zio_read_gang_members, > + zio_read_decrypt, > zio_read_decompress, > zio_done, > zio_badop > @@ -1668,6 +1740,7 @@ > BP_SET_PSIZE(bp, size); > BP_SET_COMPRESS(bp, ZIO_COMPRESS_OFF); > BP_SET_CHECKSUM(bp, ZIO_CHECKSUM_ZILOG); > + BP_SET_CRYPT(bp, ZIO_CRYPT_OFF); /* XXX darrenm */ > BP_SET_TYPE(bp, DMU_OT_INTENT_LOG); > BP_SET_LEVEL(bp, 0); > BP_SET_BYTEORDER(bp, ZFS_HOST_BYTEORDER); > > ------- usr/src/uts/common/fs/zfs/zio_crypt.c ------- > > --- /dev/null Wed May 17 04:30:04 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/fs/zfs/zio_crypt.c Tue May 16 09:29:46 2006 > @@ -1,0 +1,177 @@ > +/* > + * CDDL HEADER START > + * > + * The contents of this file are subject to the terms of the > + * Common Development and Distribution License (the "License"). > + * You may not use this file except in compliance with the License. > + * > + * You can obtain a copy of the license at usr/data/OPENSOLARIS.LICENSE > + * or http://www.opensolaris.org/os/licensing. > + * See the License for the specific language governing permissions > + * and limitations under the License. > + * > + * When distributing Covered Code, include this CDDL HEADER in each > + * file and include the License file at usr/data/OPENSOLARIS.LICENSE. > + * If applicable, add the following below this CDDL HEADER, with the > + * fields enclosed by brackets "[]" replaced with your own identifying > + * information: Portions Copyright [yyyy] [name of copyright owner] > + * > + * CDDL HEADER END > + */ > + > +/* > + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. > + * Use is subject to license terms. > + */ > + > +#pragma ident "%Z%%M% %I% %E% SMI" > + > +#include <sys/spa.h> > +#include <sys/zio.h> > +#include <sys/zio_crypt.h> > + > +#include <sys/crypto/api.h> > + > +/* > + * Cryptographic Algorithm table. > + * > + * Algorithm/Mode Keylen Option_name > + */ > +zio_crypt_info_t zio_crypt_table[ZIO_CRYPT_FUNCTIONS] = { > + "", 0, "inherit", > + "", 0, "on", > + "", 0, "off", > + SUN_CKM_AES_CBC, 128, "aes128", > + SUN_CKM_AES_CBC, 192, "aes192", > + SUN_CKM_AES_CBC, 256, "aes256" > +}; > + > +uint8_t > +zio_crypt_select(uint8_t child, uint8_t parent) > +{ > + ASSERT(child < ZIO_CRYPT_FUNCTIONS); > + ASSERT(parent < ZIO_CRYPT_FUNCTIONS); > + ASSERT(parent != ZIO_CRYPT_INHERIT && parent != ZIO_CRYPT_ON); > + > + if (child == ZIO_CRYPT_INHERIT) > + return (parent); > + > + if (child == ZIO_CRYPT_ON) > + return (ZIO_CRYPT_ON_VALUE); > + > + return (child); > +} > + > +/* > + * XXX darrenm > + * > + * ***** WARNING WARNING WARNING **** > + * This is currently a FAKE function that returns a hardcoded > + * crypto_key_t > + * ***** WARNING WARNING WARNING **** > + * > + * This function looks up the key we need based on the bookmark. > + * > + * This is where we "plugin" alternate key management systems. > + * A simple version of this has one crypto_key_t per data set > + * that we hold in memory. > + * A possible alternative would ask some "remote" key manager > + * for the keys. > + */ > +static crypto_key_t * > +zio_crypt_key_lookup(zbookmark_t bookmark) > +{ > +#ifdef _KERNEL > + static crypto_key_t *hardcoded = NULL; > + > + if (hardcoded == NULL) { > + hardcoded = kmem_alloc(sizeof (crypto_key_t), KM_SLEEP); > + } > + > + hardcoded->ck_format = CRYPTO_KEY_RAW; > + hardcoded->ck_data = "0123456789ABCDEF"; > + hardcoded->ck_length = sizeof (hardcoded->ck_data); > + > + return (hardcoded); > +#else > + return (NULL); > +#endif /* _KERNEL */ > +} > + > +void > +zio_encrypt_data(int crypt, zbookmark_t bookmark, uint64_t iv, > + void *data, uint64_t datasize, int *error) > +{ > + crypto_data_t cdata; > + crypto_mechanism_t mech; > + crypto_key_t *key; > + int ret; > + > + ASSERT(crypt < ZIO_CRYPT_FUNCTIONS); > + > +#ifdef _KERNEL > + key = zio_crypt_key_lookup(bookmark); > + if (key == NULL) { > + *error = EAGAIN; > + return; > + } > + > + mech.cm_type = crypto_mech2id(zio_crypt_table[crypt].ci_mechanism); > + mech.cm_param = (char *)&iv; > + mech.cm_param_len = sizeof (uint64_t); > + > + cdata.cd_format = CRYPTO_DATA_RAW; > + cdata.cd_offset = 0; > + cdata.cd_length = datasize; > + cdata.cd_miscdata = NULL; > + cdata.cd_raw.iov_base = (char *)data; > + cdata.cd_raw.iov_len = datasize; > + > + ret = crypto_encrypt(&mech, &cdata, key, NULL, NULL, NULL); > + if (ret != CRYPTO_SUCCESS) > + *error = EIO; > + else > +#endif /* _KERNEL */ > + *error = 0; > + > + return; > +} > + > +void > +zio_decrypt_data(int crypt, zbookmark_t bookmark, > + void *data, uint64_t datasize, int *error) > +{ > + crypto_data_t cdata; > + crypto_mechanism_t mech; > + crypto_key_t *key; > + int ret; > + > + ASSERT(crypt < ZIO_CRYPT_FUNCTIONS); > + > +#ifdef _KERNEL > + key = zio_crypt_key_lookup(bookmark); > + if (key == NULL) { > + *error = EAGAIN; > + return; > + } > + > + mech.cm_type = crypto_mech2id(zio_crypt_table[crypt].ci_mechanism); > + mech.cm_param = NULL; > + mech.cm_param_len = 0; > + > + cdata.cd_format = CRYPTO_DATA_RAW; > + cdata.cd_offset = 0; > + cdata.cd_length = datasize; > + cdata.cd_miscdata = NULL; > + cdata.cd_raw.iov_base = (char *)data; > + cdata.cd_raw.iov_len = datasize; > + > + ret = crypto_decrypt(&mech, &cdata, key, NULL, NULL, NULL); > + if (ret != CRYPTO_SUCCESS) > + *error = EIO; > + else > +#endif /* _KERNEL */ > + *error = 0; > + > + return; > +} > > ------- usr/src/uts/common/sys/fs/zfs.h ------- > > Index: usr/src/uts/common/sys/fs/zfs.h > --- /ws/onnv-clone/usr/src/uts/common/sys/fs/zfs.h Mon Apr 10 23:04:12 2006 > +++ /cube/projects/zfs-crypto/usr/src/uts/common/sys/fs/zfs.h Wed May 17 02:43:50 2006 > @@ -26,7 +26,7 @@ > #ifndef _SYS_FS_ZFS_H > #define _SYS_FS_ZFS_H > > -#pragma ident "@(#)zfs.h 1.10 06/04/10 SMI" > +#pragma ident "%Z%%M% %I% %E% SMI" > > #include <sys/types.h> > > @@ -75,6 +75,7 @@ > ZFS_PROP_SHARENFS, > ZFS_PROP_CHECKSUM, > ZFS_PROP_COMPRESSION, > + ZFS_PROP_ENCRYPTION, > ZFS_PROP_ATIME, > ZFS_PROP_DEVICES, > ZFS_PROP_EXEC, > @@ -111,7 +112,8 @@ > */ > #define ZFS_VERSION_1 1ULL > #define ZFS_VERSION_2 2ULL > -#define ZFS_VERSION ZFS_VERSION_2 > +#define ZFS_VERSION_3 3ULL > +#define ZFS_VERSION ZFS_VERSION_3 > > /* > * Symbolic names for the changes that caused a ZFS_VERSION switch. > @@ -126,6 +128,7 @@ > */ > #define ZFS_VERSION_INITIAL ZFS_VERSION_1 > #define ZFS_VERSION_DITTO_BLOCKS ZFS_VERSION_2 > +#define ZFS_VERSION_CRYPTO ZFS_VERSION_3 > > /* > * The following are configuration names used in the nvlist describing a pool''s> _______________________________________________ > zfs-code mailing list > zfs-code at opensolaris.org > http://opensolaris.org/mailman/listinfo/zfs-code-- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
Darren J Moffat
2006-May-19 14:38 UTC
[zfs-crypto-discuss] Re: [zfs-code] spa_sync assert failure vdec_config_sync
When I use ztest or zdb from the same bits I get a dangling dufs error: mix:pts/1$ ztest -VVVV 5 vdevs, 7 datasets, 23 threads, 300 seconds... capacity operations bandwidth ---- errors ---- description used avail read write read write read write cksum ztest 80.0K 238M 0 53 0 72.5K 0 0 0 mirror 80.0K 238M 0 53 0 72.5K 0 0 0 raidz 0 53 0 72.5K 0 0 0 /tmp/ztest.0a 0 560 0 1.44M 0 0 0 /tmp/ztest.1a 0 560 0 1.44M 0 0 0 /tmp/ztest.2a 0 566 0 1.44M 0 0 0 /tmp/ztest.3a 0 566 0 1.44M 0 0 0 raidz 0 53 0 72.5K 0 0 0 /tmp/ztest.4a 0 560 0 1.44M 0 0 0 /tmp/ztest.5a 0 560 0 1.44M 0 0 0 /tmp/ztest.6a 0 566 0 1.44M 0 0 0 /tmp/ztest.7a 0 566 0 1.44M 0 0 0 error: dangling dbufs (dn=102665ab0, dbuf=10266bd20) zsh: IOT instruction (core dumped) ztest -VVVV It is always the same dn and dbuf values when using ztest. The stack trace from ztest is: Loading modules: [ libumem.so.1 libzpool.so.1 libnvpair.so.1 libc.so.1 libavl.so.1 ld.so.1 ] > $c libc.so.1`_lwp_kill+8(6, 0, 100115278, ffffffffffffffff, ffffffff7ebe8000, 0) libc.so.1`abort+0x10c(1, 1d0, 8400, 0, 19f370, 0) libzpool.so.1`panic+0x1c(ffffffff7f18bb30, 102665ab0, 10266bd20, 1, 3590, 102665e30) libzpool.so.1`dnode_evict_dbufs+0x1e8(102665ab0, 10266bd78, 186, 0, ffffffff7f29e000, 102665e20) libzpool.so.1`dmu_objset_evict_dbufs+0xf4(ffffffff7ffff040, 0, 102661bc0, 162490, 10266ba00, 102661dc0) libzpool.so.1`dmu_objset_evict+0x16c(0, 102661bc0, ffffffff7ebf3180, 162318, 4, ffffffff7f29e000) libzpool.so.1`dsl_pool_close+0x48(1024afa40, 10244b488, ffffffff7ebf3180, 10244b484, ffffffff7f502000, 102661be8) libzpool.so.1`spa_unload+0x6c(10244b440, 6, 149278, 4, ffffffff7f29e000, 1) libzpool.so.1`spa_evict_all+0xcc(100115e20, 10244b440, 8e3, ffffffff7f29e000, ffffffff7f191a08, ffffffff7f1919d8) libzpool.so.1`spa_fini+0x20(5000, 6, 7, ffffffff7f29e000, 14322c, 102483500) ztest_init+0x128(100113900, 100000, 0, 10000f000, 10000f, 102425e20) main+0x234(1, 1, 100000, 1, 100113000, 100000) _start+0x17c(0, 0, 0, 0, 0, 0) Which kind of hints I might have a problem in my code rather than a hardware problem. Now were is it..... -- Darren J Moffat
Mark Shellenbaum
2006-May-19 14:54 UTC
[zfs-crypto-discuss] Re: [zfs-code] spa_sync assert failure vdec_config_sync
Darren J Moffat wrote:> When I use ztest or zdb from the same bits I get a dangling dufs error: >Make certain you are unregistering the cryp property. If the webrev you posted is still valid then it looks as if the unregistering of the propery if #if 0 out. -Mark> mix:pts/1$ ztest -VVVV > 5 vdevs, 7 datasets, 23 threads, 300 seconds... > capacity operations bandwidth ---- errors ---- > description used avail read write read write read write cksum > ztest 80.0K 238M 0 53 0 72.5K 0 0 0 > mirror 80.0K 238M 0 53 0 72.5K 0 0 0 > raidz 0 53 0 72.5K 0 0 0 > /tmp/ztest.0a 0 560 0 1.44M 0 0 0 > /tmp/ztest.1a 0 560 0 1.44M 0 0 0 > /tmp/ztest.2a 0 566 0 1.44M 0 0 0 > /tmp/ztest.3a 0 566 0 1.44M 0 0 0 > raidz 0 53 0 72.5K 0 0 0 > /tmp/ztest.4a 0 560 0 1.44M 0 0 0 > /tmp/ztest.5a 0 560 0 1.44M 0 0 0 > /tmp/ztest.6a 0 566 0 1.44M 0 0 0 > /tmp/ztest.7a 0 566 0 1.44M 0 0 0 > error: dangling dbufs (dn=102665ab0, dbuf=10266bd20) > > zsh: IOT instruction (core dumped) ztest -VVVV > > > It is always the same dn and dbuf values when using ztest. > > The stack trace from ztest is: > > Loading modules: [ libumem.so.1 libzpool.so.1 libnvpair.so.1 libc.so.1 > libavl.so.1 ld.so.1 ] > > $c > libc.so.1`_lwp_kill+8(6, 0, 100115278, ffffffffffffffff, > ffffffff7ebe8000, 0) > libc.so.1`abort+0x10c(1, 1d0, 8400, 0, 19f370, 0) > libzpool.so.1`panic+0x1c(ffffffff7f18bb30, 102665ab0, 10266bd20, 1, 3590, > 102665e30) > libzpool.so.1`dnode_evict_dbufs+0x1e8(102665ab0, 10266bd78, 186, 0, > ffffffff7f29e000, 102665e20) > libzpool.so.1`dmu_objset_evict_dbufs+0xf4(ffffffff7ffff040, 0, > 102661bc0, 162490, 10266ba00, 102661dc0) > libzpool.so.1`dmu_objset_evict+0x16c(0, 102661bc0, ffffffff7ebf3180, > 162318, 4, > ffffffff7f29e000) > libzpool.so.1`dsl_pool_close+0x48(1024afa40, 10244b488, ffffffff7ebf3180, > 10244b484, ffffffff7f502000, 102661be8) > libzpool.so.1`spa_unload+0x6c(10244b440, 6, 149278, 4, ffffffff7f29e000, 1) > libzpool.so.1`spa_evict_all+0xcc(100115e20, 10244b440, 8e3, > ffffffff7f29e000, > ffffffff7f191a08, ffffffff7f1919d8) > libzpool.so.1`spa_fini+0x20(5000, 6, 7, ffffffff7f29e000, 14322c, > 102483500) > ztest_init+0x128(100113900, 100000, 0, 10000f000, 10000f, 102425e20) > main+0x234(1, 1, 100000, 1, 100113000, 100000) > _start+0x17c(0, 0, 0, 0, 0, 0) > > > Which kind of hints I might have a problem in my code rather than a > hardware problem. > > Now were is it..... > > -- > Darren J Moffat > _______________________________________________ > zfs-code mailing list > zfs-code at opensolaris.org > http://opensolaris.org/mailman/listinfo/zfs-code
Darren J Moffat
2006-May-19 15:37 UTC
[zfs-crypto-discuss] Re: [zfs-code] spa_sync assert failure vdec_config_sync
Mark Shellenbaum wrote:> Darren J Moffat wrote: >> When I use ztest or zdb from the same bits I get a dangling dufs error: >> > > Make certain you are unregistering the cryp property. If the webrev you > posted is still valid then it looks as if the unregistering of the > propery if #if 0 out.Hmn I wonder why I did that. .... taking it out and running ztest again..... Hey that problem has gone away but now I have a new one to look at. $ ztest ztest: ''/usr/sbin/zdb -bc -U -O pre ztest'' died with signal 11 child exited with code 3 $ mdb zdb.100712.core Loading modules: [ libumem.so.1 libzpool.so.1 libavl.so.1 libnvpair.so.1 libc.so.1 ld.so.1 ] > $c zdb_space_map_load+0x34(10243f440, 100013, 100000, 10243edc0, 0, 49) dump_block_stats+0x134(10243f440, 100117, 100117, 100000, 17, 100013000) dump_zpool+0xe0(10243f440, 0, 100117000, 1001170fd, 1024cfa40, 100117) main+0x720(0, 100013000, 100011000, 0, 100117000, 100013ae0) _start+0x17c(0, 0, 0, 0, 0, 0) Thanks for spotting that one at least I can look at a different problem now - well on Monday I can its time to go home for me now. Thanks gain guys! -- Darren J Moffat