I've just resync'd my zfs-crypto workspace to onnv_39 and started some 
more serious work on this.

http://opensolaris.org/os/project/zfs-crypto/files/diffs.onnv_39

[ For those internal to SWAN this is running on mix.sfbay and the
   workspace is /net/borg.sfbay/cube/projects/zfs-crypto/ ]

I need some help with the ZIO pipeline.  I think my code should be 
getting called but it doesn't appear to be (viewing with the attached 
dtrace script).

Since we don't yet have the ability to set ZFS options at data set 
creation time I think I am simulating this by using two file systems.

mix:pts/1$ zpool list
NAME                    SIZE    USED   AVAIL    CAP  HEALTH     ALTROOT
blue                   33.8G    253K   33.7G     0%  ONLINE     -
red                    33.8G   69.5M   33.7G     0%  ONLINE     -

mix:pts/1$ zfs list
NAME                   USED  AVAIL  REFER  MOUNTPOINT
blue                   249K  33.2G  26.5K  /blue
blue/alpha             158K  33.2G   158K  /blue/alpha
red                   69.5M  33.2G  27.5K  /red
red/one               34.7M  33.2G  34.7M  /red/one
red/two               34.7M  33.2G  34.7M  /red/two

mix:pts/1$ zfs get -r encryption,checksum,compression blue
NAME             PROPERTY       VALUE                      SOURCE
blue             encryption     on                         local
blue             checksum       on                         default
blue             compression    off                        default
blue/alpha       encryption     on                         inherited 
from blue
blue/alpha       checksum       on                         default
blue/alpha       compression    off                        default


So this means that writing to /blue/alpha should not do compression but 
should do encryption with the default value (which is ZFS_CRYPT_AES_128 
== 3 in zio.h).  Using the attached D script I see this (other stuff 
removed)


   2  38702              zio_write:entry checksum 7, compress 3, crypt 3
   2  38703                 zio_write:return
   2  37758         zio_write_compress:entry
   2  37762      zio_checksum_generate:entry
   2  37763     zio_checksum_generate:return
   2  37790        zio_checksum_verify:entry
   2  37791       zio_checksum_verify:return
   2  37796        zio_read_decompress:entry
   2  37797       zio_read_decompress:return
   2  37759        zio_write_compress:return

I'm confused as to why I'm not seeing zio_write_encrypt being called
even though crypt is ZFS_CRYPT_AES_128.

The updates to zio_write() have this in them:

         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;

         if (crypt != ZIO_CRYPT_OFF)
                 zio->io_async_stages |= 1U << ZIO_STAGE_WRITE_ENCRYPT;

so with crypt being "3" we should be adding encryption into the pipeline.

See the patch for the full set of changes that show where things
like ZIO_STAGE_WRITE_ENCRYPT are set up.

So what am I missing, I feel like it is something really obvious but
I just can't see it.


-- 
Darren J Moffat
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: zfs-cryptio.d
URL: 
<http://mail.opensolaris.org/pipermail/zfs-code/attachments/20060504/ed811ca2/attachment.ksh>

Reply via email to