switch dentry_open() to struct path, make it grab references itself
[firefly-linux-kernel-4.4.55.git] / arch / powerpc / platforms / cell / spufs / inode.c
index 1c9cac0cf895665535f5c1015919b5c12607e7ba..d544d7816df3229780e4f2c58a1a28355c5c4aae 100644 (file)
@@ -317,7 +317,7 @@ out:
        return ret;
 }
 
-static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
+static int spufs_context_open(struct path *path)
 {
        int ret;
        struct file *filp;
@@ -326,11 +326,7 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
        if (ret < 0)
                return ret;
 
-       /*
-        * get references for dget and mntget, will be released
-        * in error path of *_open().
-        */
-       filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred());
+       filp = dentry_open(path, O_RDONLY, current_cred());
        if (IS_ERR(filp)) {
                put_unused_fd(ret);
                return PTR_ERR(filp);
@@ -452,6 +448,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
        int affinity;
        struct spu_gang *gang;
        struct spu_context *neighbor;
+       struct path path = {.mnt = mnt, .dentry = dentry};
 
        ret = -EPERM;
        if ((flags & SPU_CREATE_NOSCHED) &&
@@ -494,7 +491,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
                        put_spu_context(neighbor);
        }
 
-       ret = spufs_context_open(dentry, mnt);
+       ret = spufs_context_open(&path);
        if (ret < 0) {
                WARN_ON(spufs_rmdir(inode, dentry));
                if (affinity)
@@ -551,7 +548,7 @@ out:
        return ret;
 }
 
-static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
+static int spufs_gang_open(struct path *path)
 {
        int ret;
        struct file *filp;
@@ -564,7 +561,7 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
         * get references for dget and mntget, will be released
         * in error path of *_open().
         */
-       filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred());
+       filp = dentry_open(path, O_RDONLY, current_cred());
        if (IS_ERR(filp)) {
                put_unused_fd(ret);
                return PTR_ERR(filp);
@@ -579,13 +576,14 @@ static int spufs_create_gang(struct inode *inode,
                        struct dentry *dentry,
                        struct vfsmount *mnt, umode_t mode)
 {
+       struct path path = {.mnt = mnt, .dentry = dentry};
        int ret;
 
        ret = spufs_mkgang(inode, dentry, mode & S_IRWXUGO);
        if (ret)
                goto out;
 
-       ret = spufs_gang_open(dentry, mnt);
+       ret = spufs_gang_open(&path);
        if (ret < 0) {
                int err = simple_rmdir(inode, dentry);
                WARN_ON(err);