Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=03a1256f06cf1f58e33971fb4a524479e75c200e
Commit:     03a1256f06cf1f58e33971fb4a524479e75c200e
Parent:     62e1761ceff5dbb78c4b4b9486d8ca9fed11b660
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Fri Jun 8 14:14:53 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 23:40:33 2007 -0400

    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 <[EMAIL PROTECTED]>
---
 include/linux/sunrpc/rpc_pipe_fs.h |    1 +
 net/sunrpc/rpc_pipe.c              |   12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/include/linux/sunrpc/rpc_pipe_fs.h 
b/include/linux/sunrpc/rpc_pipe_fs.h
index 430cea1..51b977a 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -27,6 +27,7 @@ struct rpc_inode {
        int pipelen;
        int nreaders;
        int nwriters;
+       int nkern_readwriters;
        wait_queue_head_t waitq;
 #define RPC_PIPE_WAIT_FOR_OPEN 1
        int flags;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index e5fd796..e787b6a 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
                        dput (dentry);
                        dentry = ERR_PTR(-EBUSY);
                }
+               rpci->nkern_readwriters++;
                goto out;
        }
        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
        rpci->private = private;
        rpci->flags = flags;
        rpci->ops = ops;
+       rpci->nkern_readwriters = 1;
        inode_dir_notify(dir, DN_CREATE);
        dget(dentry);
 out:
@@ -773,10 +775,12 @@ rpc_unlink(struct dentry *dentry)
        parent = dget_parent(dentry);
        dir = parent->d_inode;
        mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
-       rpc_close_pipes(dentry->d_inode);
-       error = simple_unlink(dir, dentry);
-       if (!error)
-               d_delete(dentry);
+       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);
+       }
        dput(dentry);
        mutex_unlock(&dir->i_mutex);
        dput(parent);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to