aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sunrpc/rpc_pipe_fs.h2
-rw-r--r--net/sunrpc/clnt.c6
-rw-r--r--net/sunrpc/rpc_pipe.c18
3 files changed, 9 insertions, 17 deletions
diff --git a/include/linux/sunrpc/rpc_pipe_fs.h b/include/linux/sunrpc/rpc_pipe_fs.h
index 04d2767d5ef7..a481472c9484 100644
--- a/include/linux/sunrpc/rpc_pipe_fs.h
+++ b/include/linux/sunrpc/rpc_pipe_fs.h
@@ -42,7 +42,7 @@ RPC_I(struct inode *inode)
42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); 42extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
43 43
44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); 44extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45extern int rpc_rmdir(char *); 45extern int rpc_rmdir(struct dentry *);
46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); 46extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
47extern int rpc_unlink(struct dentry *); 47extern int rpc_unlink(struct dentry *);
48extern struct vfsmount *rpc_get_mount(void); 48extern struct vfsmount *rpc_get_mount(void);
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index d6409e757219..d307556872db 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -183,7 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
183 183
184out_no_auth: 184out_no_auth:
185 if (!IS_ERR(clnt->cl_dentry)) { 185 if (!IS_ERR(clnt->cl_dentry)) {
186 rpc_rmdir(clnt->cl_pathname); 186 rpc_rmdir(clnt->cl_dentry);
187 dput(clnt->cl_dentry); 187 dput(clnt->cl_dentry);
188 rpc_put_mount(); 188 rpc_put_mount();
189 } 189 }
@@ -320,8 +320,8 @@ rpc_destroy_client(struct rpc_clnt *clnt)
320 rpc_destroy_client(clnt->cl_parent); 320 rpc_destroy_client(clnt->cl_parent);
321 goto out_free; 321 goto out_free;
322 } 322 }
323 if (clnt->cl_pathname[0]) 323 if (!IS_ERR(clnt->cl_dentry))
324 rpc_rmdir(clnt->cl_pathname); 324 rpc_rmdir(clnt->cl_dentry);
325 if (clnt->cl_xprt) { 325 if (clnt->cl_xprt) {
326 xprt_destroy(clnt->cl_xprt); 326 xprt_destroy(clnt->cl_xprt);
327 clnt->cl_xprt = NULL; 327 clnt->cl_xprt = NULL;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 9144f2767b66..9c355e1ae61a 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -684,28 +684,20 @@ err_dput:
684} 684}
685 685
686int 686int
687rpc_rmdir(char *path) 687rpc_rmdir(struct dentry *dentry)
688{ 688{
689 struct nameidata nd; 689 struct dentry *parent;
690 struct dentry *dentry;
691 struct inode *dir; 690 struct inode *dir;
692 int error; 691 int error;
693 692
694 if ((error = rpc_lookup_parent(path, &nd)) != 0) 693 parent = dget_parent(dentry);
695 return error; 694 dir = parent->d_inode;
696 dir = nd.dentry->d_inode;
697 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 695 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
698 dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len);
699 if (IS_ERR(dentry)) {
700 error = PTR_ERR(dentry);
701 goto out_release;
702 }
703 rpc_depopulate(dentry); 696 rpc_depopulate(dentry);
704 error = __rpc_rmdir(dir, dentry); 697 error = __rpc_rmdir(dir, dentry);
705 dput(dentry); 698 dput(dentry);
706out_release:
707 mutex_unlock(&dir->i_mutex); 699 mutex_unlock(&dir->i_mutex);
708 rpc_release_path(&nd); 700 dput(parent);
709 return error; 701 return error;
710} 702}
711 703