]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ecryptfs/inode.c
Remove duplicated unlikely() in IS_ERR()
[net-next-2.6.git] / fs / ecryptfs / inode.c
index edd1e44e9d474bdb46a5b7820192cef29c95cf92..0a1397335a8eb49a245e81b1826607a5158a2685 100644 (file)
@@ -77,13 +77,13 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode,
        struct vfsmount *vfsmount_save;
        int rc;
 
-       dentry_save = nd->dentry;
-       vfsmount_save = nd->mnt;
-       nd->dentry = lower_dentry;
-       nd->mnt = lower_mnt;
+       dentry_save = nd->path.dentry;
+       vfsmount_save = nd->path.mnt;
+       nd->path.dentry = lower_dentry;
+       nd->path.mnt = lower_mnt;
        rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd);
-       nd->dentry = dentry_save;
-       nd->mnt = vfsmount_save;
+       nd->path.dentry = dentry_save;
+       nd->path.mnt = vfsmount_save;
        return rc;
 }
 
@@ -111,7 +111,7 @@ ecryptfs_do_create(struct inode *directory_inode,
 
        lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
        lower_dir_dentry = lock_parent(lower_dentry);
-       if (unlikely(IS_ERR(lower_dir_dentry))) {
+       if (IS_ERR(lower_dir_dentry)) {
                ecryptfs_printk(KERN_ERR, "Error locking directory of "
                                "dentry\n");
                rc = PTR_ERR(lower_dir_dentry);
@@ -121,7 +121,7 @@ ecryptfs_do_create(struct inode *directory_inode,
                                             ecryptfs_dentry, mode, nd);
        if (rc) {
                printk(KERN_ERR "%s: Failure to create dentry in lower fs; "
-                      "rc = [%d]\n", __FUNCTION__, rc);
+                      "rc = [%d]\n", __func__, rc);
                goto out_lock;
        }
        rc = ecryptfs_interpose(lower_dentry, ecryptfs_dentry,
@@ -819,14 +819,14 @@ ecryptfs_permission(struct inode *inode, int mask, struct nameidata *nd)
        int rc;
 
         if (nd) {
-               struct vfsmount *vfsmnt_save = nd->mnt;
-               struct dentry *dentry_save = nd->dentry;
+               struct vfsmount *vfsmnt_save = nd->path.mnt;
+               struct dentry *dentry_save = nd->path.dentry;
 
-               nd->mnt = ecryptfs_dentry_to_lower_mnt(nd->dentry);
-               nd->dentry = ecryptfs_dentry_to_lower(nd->dentry);
+               nd->path.mnt = ecryptfs_dentry_to_lower_mnt(nd->path.dentry);
+               nd->path.dentry = ecryptfs_dentry_to_lower(nd->path.dentry);
                rc = permission(ecryptfs_inode_to_lower(inode), mask, nd);
-               nd->mnt = vfsmnt_save;
-               nd->dentry = dentry_save;
+               nd->path.mnt = vfsmnt_save;
+               nd->path.dentry = dentry_save;
         } else
                rc = permission(ecryptfs_inode_to_lower(inode), mask, NULL);
         return rc;
@@ -908,7 +908,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
        if (ia->ia_valid & (ATTR_KILL_SUID | ATTR_KILL_SGID))
                ia->ia_valid &= ~ATTR_MODE;
 
+       mutex_lock(&lower_dentry->d_inode->i_mutex);
        rc = notify_change(lower_dentry, ia);
+       mutex_unlock(&lower_dentry->d_inode->i_mutex);
 out:
        fsstack_copy_attr_all(inode, lower_inode, NULL);
        return rc;