aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/file.c
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2008-07-24 00:30:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:31 -0400
commit72b55fffd631a89e5be6fe1b4f2565bc4cd90deb (patch)
treeece810c24655a6eeed96a6f2fbe14dea6478f031 /fs/ecryptfs/file.c
parent0a688ad713949643e201431d3f4a4ceddfeb70ca (diff)
eCryptfs: do not try to open device files on mknod
When creating device nodes, eCryptfs needs to delay actually opening the lower persistent file until an application tries to open. Device handles may not be backed by anything when they first come into existence. [Valdis.Kletnieks@vt.edu: build fix] Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Cc: <Valdis.Kletnieks@vt.edu} Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/file.c')
-rw-r--r--fs/ecryptfs/file.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index f0be29051528..2c2d60df3f60 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -199,6 +199,20 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
199 "file must hence be opened RO\n", __func__); 199 "file must hence be opened RO\n", __func__);
200 goto out; 200 goto out;
201 } 201 }
202 if (!ecryptfs_inode_to_private(inode)->lower_file) {
203 BUG_ON(!(crypt_stat->flags & ECRYPTFS_DELAY_PERSISTENT));
204 mutex_lock(&crypt_stat->cs_mutex);
205 crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
206 mutex_unlock(&crypt_stat->cs_mutex);
207 rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
208 if (rc) {
209 printk(KERN_ERR "%s: Error attempting to initialize "
210 "the persistent file for the dentry with name "
211 "[%s]; rc = [%d]\n", __func__,
212 ecryptfs_dentry->d_name.name, rc);
213 goto out;
214 }
215 }
202 ecryptfs_set_file_lower( 216 ecryptfs_set_file_lower(
203 file, ecryptfs_inode_to_private(inode)->lower_file); 217 file, ecryptfs_inode_to_private(inode)->lower_file);
204 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) { 218 if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {