ecryptfs: test lower_file pointer when lower_file_mutex is locked
[pandora-kernel.git] / fs / ecryptfs / file.c
index 679817e..99259f8 100644 (file)
@@ -191,15 +191,13 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
                                      | ECRYPTFS_ENCRYPTED);
        }
        mutex_unlock(&crypt_stat->cs_mutex);
-       if (!ecryptfs_inode_to_private(inode)->lower_file) {
-               rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
-               if (rc) {
-                       printk(KERN_ERR "%s: Error attempting to initialize "
-                              "the persistent file for the dentry with name "
-                              "[%s]; rc = [%d]\n", __func__,
-                              ecryptfs_dentry->d_name.name, rc);
-                       goto out_free;
-               }
+       rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
+       if (rc) {
+               printk(KERN_ERR "%s: Error attempting to initialize "
+                       "the persistent file for the dentry with name "
+                       "[%s]; rc = [%d]\n", __func__,
+                       ecryptfs_dentry->d_name.name, rc);
+               goto out_free;
        }
        if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
            && !(file->f_flags & O_RDONLY)) {