Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158564
b: refs/heads/master
c: 810d90b
h: refs/heads/master
v: v3
  • Loading branch information
Trond Myklebust authored and Trond Myklebust committed Aug 9, 2009
1 parent 19d30cb commit ea1a953
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7589806e961a16449003b636b369edec537c2726
refs/heads/master: 810d90bc2a76ff54295cfb3aa9b165160faa47ef
35 changes: 27 additions & 8 deletions trunk/net/sunrpc/rpc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,29 @@ static int __rpc_mkpipe(struct inode *dir, struct dentry *dentry,
return 0;
}

static int __rpc_unlink(struct inode *dir, struct dentry *dentry)
{
int ret;

dget(dentry);
ret = simple_unlink(dir, dentry);
d_delete(dentry);
dput(dentry);
return ret;
}

static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
struct rpc_inode *rpci = RPC_I(inode);

rpci->nkern_readwriters--;
if (rpci->nkern_readwriters != 0)
return 0;
rpc_close_pipes(inode);
return __rpc_unlink(dir, dentry);
}

/*
* FIXME: This probably has races.
*/
Expand Down Expand Up @@ -848,14 +871,15 @@ struct dentry *rpc_mkpipe(struct dentry *parent, const char *name,
rpci->ops != ops ||
rpci->flags != flags) {
dput (dentry);
dentry = ERR_PTR(-EBUSY);
err = -EBUSY;
goto out_err;
}
rpci->nkern_readwriters++;
goto out;
}

err = __rpc_mkpipe(dir, dentry, umode, &rpc_pipe_fops,
private, ops, flags);
private, ops, flags);
if (err)
goto out_err;
dget(dentry);
Expand Down Expand Up @@ -889,12 +913,7 @@ rpc_unlink(struct dentry *dentry)
parent = dget_parent(dentry);
dir = parent->d_inode;
mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
if (--RPC_I(dentry->d_inode)->nkern_readwriters == 0) {
rpc_close_pipes(dentry->d_inode);
error = simple_unlink(dir, dentry);
if (!error)
d_delete(dentry);
}
error = __rpc_rmpipe(dir, dentry);
dput(dentry);
mutex_unlock(&dir->i_mutex);
dput(parent);
Expand Down

0 comments on commit ea1a953

Please sign in to comment.