android_kernel_motorola_sm6225/fs/ecryptfs
Eric Sandeen af440f5292 ecryptfs: check for existing key_tfm at mount time
Jeff Moyer pointed out that a mount; umount loop of ecryptfs, with the same
cipher & other mount options, created a new ecryptfs_key_tfm_cache item
each time, and the cache could grow quite large this way.

Looking at this with mhalcrow, we saw that ecryptfs_parse_options()
unconditionally called ecryptfs_add_new_key_tfm(), which is what was adding
these items.

Refactor ecryptfs_get_tfm_and_mutex_for_cipher_name() to create a new
helper function, ecryptfs_tfm_exists(), which checks for the cipher on the
cached key_tfm_list, and sets a pointer to it if it exists.  This can then
be called from ecryptfs_parse_options(), and new key_tfm's can be added
only when a cached one is not found.

With list locking changes suggested by akpm.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-06 10:41:13 -08:00
..
crypto.c ecryptfs: check for existing key_tfm at mount time 2008-02-06 10:41:13 -08:00
debug.c eCryptfs: update comment and debug statement 2007-10-16 09:43:11 -07:00
dentry.c [PATCH] eCryptfs: fix possible NULL ptr deref in ecryptfs_d_release() 2007-03-16 19:25:05 -07:00
ecryptfs_kernel.h ecryptfs: check for existing key_tfm at mount time 2008-02-06 10:41:13 -08:00
file.c eCryptfs: Minor fixes to printk messages 2008-02-06 10:41:12 -08:00
inode.c eCryptfs: Minor fixes to printk messages 2008-02-06 10:41:12 -08:00
keystore.c eCryptfs: change the type of cipher_code from u16 to u8 2008-02-06 10:41:13 -08:00
main.c ecryptfs: check for existing key_tfm at mount time 2008-02-06 10:41:13 -08:00
Makefile eCryptfs: read_write.c routines 2007-10-16 09:43:12 -07:00
messaging.c ecryptfs: fix unlocking in error paths 2007-12-23 12:54:37 -08:00
mmap.c eCryptfs: track header bytes rather than extents 2008-02-06 10:41:12 -08:00
netlink.c [NETNS]: Consolidate kernel netlink socket destruction. 2008-01-28 15:08:07 -08:00
read_write.c fs/ecryptfs/: possible cleanups 2008-02-06 10:41:12 -08:00
super.c ecryptfs: remove debug as mount option, and warn if set via modprobe 2008-02-06 10:41:12 -08:00