Commit dff02cc1 authored by Trond Myklebust's avatar Trond Myklebust

NFS: clean up rpc_rmdir

Make it take a dentry argument instead of a path
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
(cherry picked from 648d4116eb2509f010f7f34704a650150309b3e7 commit)
parent 5d67476f
...@@ -42,7 +42,7 @@ RPC_I(struct inode *inode) ...@@ -42,7 +42,7 @@ RPC_I(struct inode *inode)
extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
extern int rpc_rmdir(char *); extern int rpc_rmdir(struct dentry *);
extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
extern int rpc_unlink(struct dentry *); extern int rpc_unlink(struct dentry *);
extern struct vfsmount *rpc_get_mount(void); extern struct vfsmount *rpc_get_mount(void);
......
...@@ -183,7 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, ...@@ -183,7 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
out_no_auth: out_no_auth:
if (!IS_ERR(clnt->cl_dentry)) { if (!IS_ERR(clnt->cl_dentry)) {
rpc_rmdir(clnt->cl_pathname); rpc_rmdir(clnt->cl_dentry);
dput(clnt->cl_dentry); dput(clnt->cl_dentry);
rpc_put_mount(); rpc_put_mount();
} }
...@@ -320,8 +320,8 @@ rpc_destroy_client(struct rpc_clnt *clnt) ...@@ -320,8 +320,8 @@ rpc_destroy_client(struct rpc_clnt *clnt)
rpc_destroy_client(clnt->cl_parent); rpc_destroy_client(clnt->cl_parent);
goto out_free; goto out_free;
} }
if (clnt->cl_pathname[0]) if (!IS_ERR(clnt->cl_dentry))
rpc_rmdir(clnt->cl_pathname); rpc_rmdir(clnt->cl_dentry);
if (clnt->cl_xprt) { if (clnt->cl_xprt) {
xprt_destroy(clnt->cl_xprt); xprt_destroy(clnt->cl_xprt);
clnt->cl_xprt = NULL; clnt->cl_xprt = NULL;
......
...@@ -684,28 +684,20 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client) ...@@ -684,28 +684,20 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
} }
int int
rpc_rmdir(char *path) rpc_rmdir(struct dentry *dentry)
{ {
struct nameidata nd; struct dentry *parent;
struct dentry *dentry;
struct inode *dir; struct inode *dir;
int error; int error;
if ((error = rpc_lookup_parent(path, &nd)) != 0) parent = dget_parent(dentry);
return error; dir = parent->d_inode;
dir = nd.dentry->d_inode;
mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len);
if (IS_ERR(dentry)) {
error = PTR_ERR(dentry);
goto out_release;
}
rpc_depopulate(dentry); rpc_depopulate(dentry);
error = __rpc_rmdir(dir, dentry); error = __rpc_rmdir(dir, dentry);
dput(dentry); dput(dentry);
out_release:
mutex_unlock(&dir->i_mutex); mutex_unlock(&dir->i_mutex);
rpc_release_path(&nd); dput(parent);
return error; return error;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment