]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/ecryptfs/file.c
blackfin: use kbuild.h instead of defining macros in asm-macros.c
[linux-2.6-omap-h63xx.git] / fs / ecryptfs / file.c
index 95be9a90c504dd6e5ced49062f8ecb9c618a4aff..2258b8f654a62ff7f45e6df55cd3a501d1c5dc25 100644 (file)
@@ -141,34 +141,6 @@ retry:
 
 struct kmem_cache *ecryptfs_file_info_cache;
 
-int ecryptfs_open_lower_file(struct file **lower_file,
-                            struct dentry *lower_dentry,
-                            struct vfsmount *lower_mnt, int flags)
-{
-       int rc = 0;
-
-       flags |= O_LARGEFILE;
-       dget(lower_dentry);
-       mntget(lower_mnt);
-       *lower_file = dentry_open(lower_dentry, lower_mnt, flags);
-       if (IS_ERR(*lower_file)) {
-               printk(KERN_ERR "Error opening lower file for lower_dentry "
-                      "[0x%p], lower_mnt [0x%p], and flags [0x%x]\n",
-                      lower_dentry, lower_mnt, flags);
-               rc = PTR_ERR(*lower_file);
-               *lower_file = NULL;
-               goto out;
-       }
-out:
-       return rc;
-}
-
-int ecryptfs_close_lower_file(struct file *lower_file)
-{
-       fput(lower_file);
-       return 0;
-}
-
 /**
  * ecryptfs_open
  * @inode: inode speciying file to open
@@ -223,7 +195,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
                file, ecryptfs_inode_to_private(inode)->lower_file);
        if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
                ecryptfs_printk(KERN_DEBUG, "This is a directory\n");
+               mutex_lock(&crypt_stat->cs_mutex);
                crypt_stat->flags &= ~(ECRYPTFS_ENCRYPTED);
+               mutex_unlock(&crypt_stat->cs_mutex);
                rc = 0;
                goto out;
        }
@@ -237,9 +211,10 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
                        if (!(mount_crypt_stat->flags
                              & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
                                rc = -EIO;
-                               printk(KERN_WARNING "Attempt to read file that "
+                               printk(KERN_WARNING "Either the lower file "
                                       "is not in a valid eCryptfs format, "
-                                      "and plaintext passthrough mode is not "
+                                      "or the key could not be retrieved. "
+                                      "Plaintext passthrough mode is not "
                                       "enabled; returning -EIO\n");
                                mutex_unlock(&crypt_stat->cs_mutex);
                                goto out_free;