Commit bf349a44 authored by Al Viro's avatar Al Viro

spufs: shift dget/mntget towards dentry_open()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 3b6456d2
...@@ -323,22 +323,21 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt) ...@@ -323,22 +323,21 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
struct file *filp; struct file *filp;
ret = get_unused_fd(); ret = get_unused_fd();
if (ret < 0) { if (ret < 0)
dput(dentry); return ret;
mntput(mnt);
goto out;
}
filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); /*
* 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());
if (IS_ERR(filp)) { if (IS_ERR(filp)) {
put_unused_fd(ret); put_unused_fd(ret);
ret = PTR_ERR(filp); return PTR_ERR(filp);
goto out;
} }
filp->f_op = &spufs_context_fops; filp->f_op = &spufs_context_fops;
fd_install(ret, filp); fd_install(ret, filp);
out:
return ret; return ret;
} }
...@@ -495,11 +494,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, ...@@ -495,11 +494,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
put_spu_context(neighbor); put_spu_context(neighbor);
} }
/* ret = spufs_context_open(dentry, mnt);
* get references for dget and mntget, will be released
* in error path of *_open().
*/
ret = spufs_context_open(dget(dentry), mntget(mnt));
if (ret < 0) { if (ret < 0) {
WARN_ON(spufs_rmdir(inode, dentry)); WARN_ON(spufs_rmdir(inode, dentry));
if (affinity) if (affinity)
...@@ -562,22 +557,21 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt) ...@@ -562,22 +557,21 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt)
struct file *filp; struct file *filp;
ret = get_unused_fd(); ret = get_unused_fd();
if (ret < 0) { if (ret < 0)
dput(dentry); return ret;
mntput(mnt);
goto out;
}
filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); /*
* 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());
if (IS_ERR(filp)) { if (IS_ERR(filp)) {
put_unused_fd(ret); put_unused_fd(ret);
ret = PTR_ERR(filp); return PTR_ERR(filp);
goto out;
} }
filp->f_op = &simple_dir_operations; filp->f_op = &simple_dir_operations;
fd_install(ret, filp); fd_install(ret, filp);
out:
return ret; return ret;
} }
...@@ -591,11 +585,7 @@ static int spufs_create_gang(struct inode *inode, ...@@ -591,11 +585,7 @@ static int spufs_create_gang(struct inode *inode,
if (ret) if (ret)
goto out; goto out;
/* ret = spufs_gang_open(dentry, mnt);
* get references for dget and mntget, will be released
* in error path of *_open().
*/
ret = spufs_gang_open(dget(dentry), mntget(mnt));
if (ret < 0) { if (ret < 0) {
int err = simple_rmdir(inode, dentry); int err = simple_rmdir(inode, dentry);
WARN_ON(err); WARN_ON(err);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment