linux/fs/crypto
Eric Biggers 2c58d548f5 fscrypt: cache decrypted symlink target in ->i_link
Path lookups that traverse encrypted symlink(s) are very slow because
each encrypted symlink needs to be decrypted each time it's followed.
This also involves dropping out of rcu-walk mode.

Make encrypted symlinks faster by caching the decrypted symlink target
in ->i_link.  The first call to fscrypt_get_symlink() sets it.  Then,
the existing VFS path lookup code uses the non-NULL ->i_link to take the
fast path where ->get_link() isn't called, and lookups in rcu-walk mode
remain in rcu-walk mode.

Also set ->i_link immediately when a new encrypted symlink is created.

To safely free the symlink target after an RCU grace period has elapsed,
introduce a new function fscrypt_free_inode(), and make the relevant
filesystems call it just before actually freeing the inode.

Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2019-04-17 12:43:29 -04:00
..
bio.c fscrypt: remove WARN_ON_ONCE() when decryption fails 2019-04-16 18:44:44 -04:00
crypto.c fscrypt: clean up and improve dentry revalidation 2019-04-17 09:48:46 -04:00
fname.c fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext 2019-04-17 10:07:51 -04:00
fscrypt_private.h fscrypt: remove filesystem specific build config option 2019-01-23 23:56:43 -05:00
hooks.c fscrypt: cache decrypted symlink target in ->i_link 2019-04-17 12:43:29 -04:00
Kconfig fscrypt: remove filesystem specific build config option 2019-01-23 23:56:43 -05:00
keyinfo.c fscrypt: cache decrypted symlink target in ->i_link 2019-04-17 12:43:29 -04:00
Makefile fscrypt: new helper function - fscrypt_file_open() 2017-10-18 19:52:37 -04:00
policy.c fscrypt: use READ_ONCE() to access ->i_crypt_info 2019-04-16 18:57:09 -04:00