Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124758
b: refs/heads/master
c: c381060
h: refs/heads/master
v: v3
  • Loading branch information
\"J. Bruce Fields\ authored and Trond Myklebust committed Dec 23, 2008
1 parent 7759808 commit 1008804
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 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: db75b3d6b5b0dad29860370618ea94d2726641b4
refs/heads/master: c381060869317b3c84430d4f54965d409cbfe65f
1 change: 1 addition & 0 deletions trunk/include/linux/sunrpc/rpc_pipe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ struct rpc_pipe_ops {
ssize_t (*upcall)(struct file *, struct rpc_pipe_msg *, char __user *, size_t);
ssize_t (*downcall)(struct file *, const char __user *, size_t);
void (*release_pipe)(struct inode *);
int (*open_pipe)(struct inode *);
void (*destroy_msg)(struct rpc_pipe_msg *);
};

Expand Down
22 changes: 15 additions & 7 deletions trunk/net/sunrpc/rpc_pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,24 @@ static int
rpc_pipe_open(struct inode *inode, struct file *filp)
{
struct rpc_inode *rpci = RPC_I(inode);
int first_open;
int res = -ENXIO;

mutex_lock(&inode->i_mutex);
if (rpci->ops != NULL) {
if (filp->f_mode & FMODE_READ)
rpci->nreaders ++;
if (filp->f_mode & FMODE_WRITE)
rpci->nwriters ++;
res = 0;
if (rpci->ops == NULL)
goto out;
first_open = rpci->nreaders == 0 && rpci->nwriters == 0;
if (first_open && rpci->ops->open_pipe) {
res = rpci->ops->open_pipe(inode);
if (res)
goto out;
}
if (filp->f_mode & FMODE_READ)
rpci->nreaders++;
if (filp->f_mode & FMODE_WRITE)
rpci->nwriters++;
res = 0;
out:
mutex_unlock(&inode->i_mutex);
return res;
}
Expand Down Expand Up @@ -748,7 +756,7 @@ rpc_rmdir(struct dentry *dentry)
* @name: name of pipe
* @private: private data to associate with the pipe, for the caller's use
* @ops: operations defining the behavior of the pipe: upcall, downcall,
* release_pipe, and destroy_msg.
* release_pipe, open_pipe, and destroy_msg.
* @flags: rpc_inode flags
*
* Data is made available for userspace to read by calls to
Expand Down

0 comments on commit 1008804

Please sign in to comment.