]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fscrypt: clean up and improve dentry revalidation
authorEric Biggers <ebiggers@google.com>
Sat, 31 Oct 2020 22:05:49 +0000 (15:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:08:35 +0000 (11:08 +0100)
commit1ae161d27b01ebe062cc4bf228a1e5debc473310
tree78d163916ca3298caca0dc3ad54260230b05f616
parent705ac26aedd49372c121c91af921e7069ff1ceff
fscrypt: clean up and improve dentry revalidation

commit 6cc248684d3d23bbd073ae2fa73d3416c0558909 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/crypto/crypto.c
fs/crypto/hooks.c
include/linux/dcache.h
include/linux/fscrypt.h