On Fri, May 22, 2026 at 02:00:28PM +0200, Daniel Vacek wrote:
> > How does this handled adding/removing devices at runtime?
> 
> When called, this callback returns the list of bdevs opened by the
> given superblock. If devices are added or removed, this function
> returns a different list.
> In other words it always returns a valid list.
> 
> This is called from `fscrypt_get_devices()`, which is called from
> `fscrypt_select_encryption_impl()` or
> `fscrypt_prepare_inline_crypt_key()` or
> `fscrypt_destroy_inline_crypt_key()`. All these functions walk the
> returned list and discard it immediately afterwards.
> 
> Note that with btrfs at this point we're only using the inline crypto 
> fallback.
> Is there any particular reason you asked this question?

Well, assume you have a single device fs, and then you add a device
later, you will not get the blk_crypto_config_supported call for this
device, and it will not be taken into account.

Now can btrfs even support hardware inline encryption?  The way the bio
processing is special cased I somehow doubt it.  But the concept of a
static device list just doesn't work for btrfs, so I think the fscrypt
side of this will need refactoring not to rely on it.  If we never
support hardware inline encryption on such dynamic file systems that
would be relative easy, if we need to support that case things might
get a lot more complicated.


Reply via email to