History

NFS: clean up rpc_rmdir

Make it take a dentry argument instead of a path

Trond Myklebust committed 20 years ago

Commit dff02cc1 parent 5d674763 files · +9 −17Browse files

Unified · Split

3 files
  1. include/linux/sunrpc/rpc_pipe_fs.h +1 −1
  2. net/sunrpc/clnt.c +3 −3
  3. net/sunrpc/rpc_pipe.c +5 −13
include/linux/sunrpc/rpc_pipe_fs.h+1−1
@@ -42,7 +42,7 @@ RPC_I(struct inode *inode) · 41 unmodified lines
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);
net/sunrpc/clnt.c+3−3
@@ -183,7 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, · 182 unmodified lines
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) · 130 unmodified lines
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;
net/sunrpc/rpc_pipe.c+5−13
@@ -684,28 +684,20 @@ err_dput: · 683 unmodified lines
684}684}
685 685
686int686int
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