Make it take a dentry argument instead of a path
Unified · Split
| @@ -42,7 +42,7 @@ RPC_I(struct inode *inode) · 41 unmodified lines | ||
| 42 | 42 | extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); |
| 43 | 43 | |
| 44 | 44 | extern struct dentry *rpc_mkdir(char *, struct rpc_clnt *); |
| 45 | −extern int rpc_rmdir(char *); | |
| 45 | +extern int rpc_rmdir(struct dentry *); | |
| 46 | 46 | extern struct dentry *rpc_mkpipe(char *, void *, struct rpc_pipe_ops *, int flags); |
| 47 | 47 | extern int rpc_unlink(struct dentry *); |
| 48 | 48 | extern struct vfsmount *rpc_get_mount(void); |
| @@ -183,7 +183,7 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname, · 182 unmodified lines | ||
| 183 | 183 | |
| 184 | 184 | out_no_auth: |
| 185 | 185 | if (!IS_ERR(clnt->cl_dentry)) { |
| 186 | − rpc_rmdir(clnt->cl_pathname); | |
| 186 | + rpc_rmdir(clnt->cl_dentry); | |
| 187 | 187 | dput(clnt->cl_dentry); |
| 188 | 188 | rpc_put_mount(); |
| 189 | 189 | } |
| @@ -320,8 +320,8 @@ rpc_destroy_client(struct rpc_clnt *clnt) · 130 unmodified lines | ||
| 320 | 320 | rpc_destroy_client(clnt->cl_parent); |
| 321 | 321 | goto out_free; |
| 322 | 322 | } |
| 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); | |
| 325 | 325 | if (clnt->cl_xprt) { |
| 326 | 326 | xprt_destroy(clnt->cl_xprt); |
| 327 | 327 | clnt->cl_xprt = NULL; |
| @@ -684,28 +684,20 @@ err_dput: · 683 unmodified lines | ||
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | int |
| 687 | −rpc_rmdir(char *path) | |
| 687 | +rpc_rmdir(struct dentry *dentry) | |
| 688 | 688 | { |
| 689 | − struct nameidata nd; | |
| 690 | − struct dentry *dentry; | |
| 689 | + struct dentry *parent; | |
| 691 | 690 | struct inode *dir; |
| 692 | 691 | int error; |
| 693 | 692 | |
| 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; | |
| 697 | 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 | 696 | rpc_depopulate(dentry); |
| 704 | 697 | error = __rpc_rmdir(dir, dentry); |
| 705 | 698 | dput(dentry); |
| 706 | −out_release: | |
| 707 | 699 | mutex_unlock(&dir->i_mutex); |
| 708 | − rpc_release_path(&nd); | |
| 700 | + dput(parent); | |
| 709 | 701 | return error; |
| 710 | 702 | } |
| 711 | 703 | |