diff options
author | Eric Biggers <ebiggers@google.com> | 2019-03-20 11:39:09 -0700 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2019-04-17 09:48:46 -0400 |
commit | 6cc248684d3d23bbd073ae2fa73d3416c0558909 (patch) | |
tree | 1fe0b6a608ccdae37511795fd20857e45435622d /include/linux/fscrypt.h | |
parent | e37a784d8b6a1e726de5ddc7b4809c086a08db09 (diff) |
fscrypt: clean up and improve dentry revalidation
Make various improvements to fscrypt dentry revalidation:
- Don't try to handle the case where the per-directory key is removed,
as this can't happen without the inode (and dentries) being evicted.
- Flag ciphertext dentries rather than plaintext dentries, since it's
ciphertext dentries that need the special handling.
- Avoid doing unnecessary work for non-ciphertext dentries.
- When revalidating ciphertext dentries, try to set up the directory's
i_crypt_info to make sure the key is really still absent, rather than
invalidating all negative dentries as the previous code did. An old
comment suggested we can't do this for locking reasons, but AFAICT
this comment was outdated and it actually works fine.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include/linux/fscrypt.h')
-rw-r--r-- | include/linux/fscrypt.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index ec8ab7108599..09e368a515d1 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -545,10 +545,8 @@ static inline int fscrypt_prepare_rename(struct inode *old_dir, * filenames are presented in encrypted form. Therefore, we'll try to set up * the directory's encryption key, but even without it the lookup can continue. * - * To allow invalidating stale dentries if the directory's encryption key is - * added later, we also install a custom ->d_revalidate() method and use the - * DCACHE_ENCRYPTED_WITH_KEY flag to indicate whether a given dentry is a - * plaintext name (flag set) or a ciphertext name (flag cleared). + * This also installs a custom ->d_revalidate() method which will invalidate the + * dentry if it was created without the key and the key is later added. * * Return: 0 on success, -errno if a problem occurred while setting up the * encryption key |