aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-08 14:14:53 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:33 -0400
commit03a1256f06cf1f58e33971fb4a524479e75c200e (patch)
tree29da3d4cee02e06e17fcb5087081602f8475b2e5 /net/sunrpc/rpc_pipe.c
parent62e1761ceff5dbb78c4b4b9486d8ca9fed11b660 (diff)
SUNRPC: Add a field to track the number of kernel users of an rpc_pipe
This allows us to correctly deduce when we need to remove the pipe. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index e5fd796e897e..e787b6a43eee 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -737,6 +737,7 @@ rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pi
737 dput (dentry); 737 dput (dentry);
738 dentry = ERR_PTR(-EBUSY); 738 dentry = ERR_PTR(-EBUSY);
739 } 739 }
740 rpci->nkern_readwriters++;
740 goto out; 741 goto out;
741 } 742 }
742 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR); 743 inode = rpc_get_inode(dir->i_sb, S_IFIFO | S_IRUSR | S_IWUSR);
@@ -749,6 +750,7 @@ rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pi
749 rpci->private = private; 750 rpci->private = private;
750 rpci->flags = flags; 751 rpci->flags = flags;
751 rpci->ops = ops; 752 rpci->ops = ops;
753 rpci->nkern_readwriters = 1;
752 inode_dir_notify(dir, DN_CREATE); 754 inode_dir_notify(dir, DN_CREATE);
753 dget(dentry); 755 dget(dentry);
754out: 756out:
@@ -773,10 +775,12 @@ rpc_unlink(struct dentry *dentry)
773 parent = dget_parent(dentry); 775 parent = dget_parent(dentry);
774 dir = parent->d_inode; 776 dir = parent->d_inode;
775 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 777 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
776 rpc_close_pipes(dentry->d_inode); 778 if (--RPC_I(dentry->d_inode)->nkern_readwriters == 0) {
777 error = simple_unlink(dir, dentry); 779 rpc_close_pipes(dentry->d_inode);
778 if (!error) 780 error = simple_unlink(dir, dentry);
779 d_delete(dentry); 781 if (!error)
782 d_delete(dentry);
783 }
780 dput(dentry); 784 dput(dentry);
781 mutex_unlock(&dir->i_mutex); 785 mutex_unlock(&dir->i_mutex);
782 dput(parent); 786 dput(parent);