eCryptfs: Make all persistent file opens delayed

There is no good reason to immediately open the lower file, and that can
cause problems with files that the user does not intend to immediately
open, such as device nodes.

This patch removes the persistent file open from the interpose step and
pushes that to the locations where eCryptfs really does need the lower
persistent file, such as just before reading or writing the metadata
stored in the lower file header.

Two functions are jumping to out_dput when they should just be jumping to
out on error paths.  This patch also fixes these.

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Michael Halcrow
2008-07-23 21:30:08 -07:00
committed by Linus Torvalds
parent 72b55fffd6
commit 391b52f98c
4 changed files with 23 additions and 26 deletions

View File

@ -200,10 +200,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
goto out;
}
if (!ecryptfs_inode_to_private(inode)->lower_file) {
BUG_ON(!(crypt_stat->flags & ECRYPTFS_DELAY_PERSISTENT));
mutex_lock(&crypt_stat->cs_mutex);
crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
mutex_unlock(&crypt_stat->cs_mutex);
rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
if (rc) {
printk(KERN_ERR "%s: Error attempting to initialize "