aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-07-31 17:17:18 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-08-24 15:50:32 -0400
commitdff02cc1a34fcb60904a2c57cb351857cc11219e (patch)
treee15957078e7f03f8b2b758cee0f7362d42f83c80 /net
parent5d67476fff2df6ff12f60b540fd0e74cf2a668f9 (diff)
NFS: clean up rpc_rmdir
Make it take a dentry argument instead of a path Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> (cherry picked from 648d4116eb2509f010f7f34704a650150309b3e7 commit)
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c6
-rw-r--r--net/sunrpc/rpc_pipe.c18
2 files changed, 8 insertions, 16 deletions
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