Context: For the ZFS Crypto project we have a property keyscope that 
determines wither or not the pool key or a per-dataset key should be used.

For encryption=on and keyscope=pool we just require that the pool key 
have been loaded already, and we can check that by looking at the 
keystatus property on the pool.   This works just fine.

When creating datasets with keyscope=dataset we need to get the key 
material *before* we call down to the kernel using ZFS_IOC_CREATE. If 
encryption=off or keyscope=pool then there is nothing to do in terms of 
getting keys.

To do this I need to determine the value of the encryption 
(PROP_ONETIME), keyscope (PROP_INHERIT) and keysource (PROP_INHERIT) 
properties (in that order).  If they are explicitly specified there is 
no problem because the will be in the nvprops.  However if they are to 
be inherited they won't be in nvprops since inheritance hasn't happened 
yet (since we are still in libzfs`zfs_create()).

I believe I need to get a handle for the parent dataset and use 
zfs_prop_get() to find the value from the parent.  Is there another, 
perhaps better, way to do this ?

-- 
Darren J Moffat

Reply via email to