OSDN Git Service

Merge android-4.4-p.203 (40ef73d) into msm-4.4
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / fs / ecryptfs / inode.c
index 34897ae..9e143b0 100644 (file)
@@ -261,12 +261,15 @@ out:
  *
  * Returns zero on success; non-zero on error condition
  */
+
+
 static int
 ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
                umode_t mode, bool excl)
 {
        struct inode *ecryptfs_inode;
        int rc;
+       struct ecryptfs_crypt_stat *crypt_stat;
 
        ecryptfs_inode = ecryptfs_do_create(directory_inode, ecryptfs_dentry,
                                            mode);
@@ -276,6 +279,7 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
                rc = PTR_ERR(ecryptfs_inode);
                goto out;
        }
+
        /* At this point, a file exists on "disk"; we need to make sure
         * that this on disk file is prepared to be an ecryptfs file */
        rc = ecryptfs_initialize_file(ecryptfs_dentry, ecryptfs_inode);
@@ -287,7 +291,15 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
                iput(ecryptfs_inode);
                goto out;
        }
-       d_instantiate_new(ecryptfs_dentry, ecryptfs_inode);
+
+       crypt_stat = &ecryptfs_inode_to_private(ecryptfs_inode)->crypt_stat;
+       if (get_events() && get_events()->open_cb)
+                       get_events()->open_cb(
+                               ecryptfs_inode_to_lower(ecryptfs_inode),
+                                       crypt_stat);
+
+       unlock_new_inode(ecryptfs_inode);
+       d_instantiate(ecryptfs_dentry, ecryptfs_inode);
 out:
        return rc;
 }