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
4242 extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *);
4343
4444 extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *);
45−extern int rpc_rmdir(char *);
45+extern int rpc_rmdir(struct dentry *);
4646 extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags);
4747 extern int rpc_unlink(struct dentry *);
4848 extern 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
183183
184184 out_no_auth:
185185 if (!IS_ERR(clnt->cl_dentry)) {
186− rpc_rmdir(clnt->cl_pathname);
186+ rpc_rmdir(clnt->cl_dentry);
187187 dput(clnt->cl_dentry);
188188 rpc_put_mount();
189189 }
@@ -320,8 +320,8 @@ rpc_destroy_client(struct rpc_clnt *clnt) · 130 unmodified lines
320320 rpc_destroy_client(clnt->cl_parent);
321321 goto out_free;
322322 }
323− if (clnt->cl_pathname[0])
324− rpc_rmdir(clnt->cl_pathname);
323+ if (!IS_ERR(clnt->cl_dentry))
324+ rpc_rmdir(clnt->cl_dentry);
325325 if (clnt->cl_xprt) {
326326 xprt_destroy(clnt->cl_xprt);
327327 clnt->cl_xprt = NULL;
net/sunrpc/rpc_pipe.c+5−13
@@ -684,28 +684,20 @@ err_dput: · 683 unmodified lines
684684 }
685685
686686 int
687−rpc_rmdir(char *path)
687+rpc_rmdir(struct dentry *dentry)
688688 {
689− struct nameidata nd;
690− struct dentry *dentry;
689+ struct dentry *parent;
691690 struct inode *dir;
692691 int error;
693692
694− if ((error = rpc_lookup_parent(path, &nd)) != 0)
695− return error;
696− dir = nd.dentry->d_inode;
693+ parent = dget_parent(dentry);
694+ dir = parent->d_inode;
697695 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− }
703696 rpc_depopulate(dentry);
704697 error = __rpc_rmdir(dir, dentry);
705698 dput(dentry);
706−out_release:
707699 mutex_unlock(&dir->i_mutex);
708− rpc_release_path(&nd);
700+ dput(parent);
709701 return error;
710702 }
711703