Re: [PATCH v2 07/14] fscrypt: notify per-extent infos if master key vanishes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 09, 2023 at 02:53:40PM -0400, Sweet Tea Dorminy wrote:
> When fscrypt_infos can be owned by an extent, we need some way to
> attempt to evict the extent infos in the same way we evict inodes.
> This change adds a function pointer to allow a filesystem to optionally
> provide a way to evict extents; locking if needed must be handled by the
> filesystem.
> 
> Signed-off-by: Sweet Tea Dorminy <sweettea-kernel@xxxxxxxxxx>
> ---
>  fs/crypto/keyring.c     | 11 ++++++++++-
>  include/linux/fscrypt.h |  9 +++++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/crypto/keyring.c b/fs/crypto/keyring.c
> index 7cbb1fd872ac..0aad825087c1 100644
> --- a/fs/crypto/keyring.c
> +++ b/fs/crypto/keyring.c
> @@ -875,6 +875,16 @@ static void evict_dentries_for_decrypted_inodes(struct fscrypt_master_key *mk)
>  
>  	list_for_each_entry(ci, &mk->mk_decrypted_inodes, ci_master_key_link) {
>  		inode = ci->ci_inode;
> +		if (!inode) {
> +			if (!ci->ci_sb->s_cop->forget_extent_info)
> +				continue;
> +
> +			spin_unlock(&mk->mk_decrypted_inodes_lock);
> +			ci->ci_sb->s_cop->forget_extent_info(ci->ci_info_ptr);
> +			spin_lock(&mk->mk_decrypted_inodes_lock);
> +			continue;
> +		}
> +
>  		spin_lock(&inode->i_lock);
>  		if (inode->i_state & (I_FREEING | I_WILL_FREE | I_NEW)) {
>  			spin_unlock(&inode->i_lock);
> @@ -887,7 +897,6 @@ static void evict_dentries_for_decrypted_inodes(struct fscrypt_master_key *mk)
>  		shrink_dcache_inode(inode);
>  		iput(toput_inode);
>  		toput_inode = inode;
> -

Errant whitespace change.  Thanks,

Josef



[Index of Archives]     [linux Cryptography]     [Asterisk App Development]     [PJ SIP]     [Gnu Gatekeeper]     [IETF Sipping]     [Info Cyrus]     [ALSA User]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite News]     [Deep Creek Hot Springs]     [Yosemite Campsites]     [ISDN Cause Codes]

  Powered by Linux