Re: [PATCH] fscrypt: move the call to fscrypt_destroy_keyring() into ->put_super()

Josef Bacik
2023-12-06T00:22:01Z

On Tue, Dec 05, 2023 at 04:13:24PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> btrfs, which is planning to add support for fscrypt, has a variety of
> asynchronous things it does with inodes that can potentially last until
> ->put_super, when it shuts everything down and cleans up all async work.
> Consequently, btrfs needs the call to fscrypt_destroy_keyring() to
> happen either after or within ->put_super.
>
> Meanwhile, f2fs needs the call to fscrypt_destroy_keyring() to happen
> either *before* or within ->put_super, due to the dependency of
> f2fs_get_devices() on ->s_fs_info still existing.
>
> To meet both of these constraints, this patch moves the keyring
> destruction into ->put_super. This gives filesystems some flexibility
> into when it is done. This does mean that the VFS no longer handles it
> automatically for filesystems, which is unfortunate, though this is in
> line with most of the other fscrypt functions.
>
> (The fscrypt keyring destruction has now been changed an embarrassingly
> large number of times. Hopefully this will be The Last Change That
> Finally Gets It Right!)
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef