Commit 5d67476f authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: make rpc_unlink() take a dentry argument instead of a path

Signe-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
(cherry picked from 88bf6d811b01a4be7fd507d18bf5f1c527989089 commit)
parent a634904a
...@@ -130,9 +130,8 @@ nfs_idmap_delete(struct nfs4_client *clp) ...@@ -130,9 +130,8 @@ nfs_idmap_delete(struct nfs4_client *clp)
if (!idmap) if (!idmap)
return; return;
rpc_unlink(idmap->idmap_dentry);
dput(idmap->idmap_dentry); dput(idmap->idmap_dentry);
idmap->idmap_dentry = NULL;
rpc_unlink(idmap->idmap_path);
clp->cl_idmap = NULL; clp->cl_idmap = NULL;
kfree(idmap); kfree(idmap);
} }
......
...@@ -44,7 +44,7 @@ extern int rpc_queue_upcall(struct inode *, struct rpc_pipe_msg *); ...@@ -44,7 +44,7 @@ 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(char *);
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(char *); extern int rpc_unlink(struct dentry *);
extern struct vfsmount *rpc_get_mount(void); extern struct vfsmount *rpc_get_mount(void);
extern void rpc_put_mount(void); extern void rpc_put_mount(void);
......
...@@ -718,7 +718,7 @@ gss_destroy(struct rpc_auth *auth) ...@@ -718,7 +718,7 @@ gss_destroy(struct rpc_auth *auth)
auth, auth->au_flavor); auth, auth->au_flavor);
gss_auth = container_of(auth, struct gss_auth, rpc_auth); gss_auth = container_of(auth, struct gss_auth, rpc_auth);
rpc_unlink(gss_auth->path); rpc_unlink(gss_auth->dentry);
dput(gss_auth->dentry); dput(gss_auth->dentry);
gss_auth->dentry = NULL; gss_auth->dentry = NULL;
gss_mech_put(gss_auth->mech); gss_mech_put(gss_auth->mech);
......
...@@ -746,22 +746,15 @@ err_dput: ...@@ -746,22 +746,15 @@ err_dput:
} }
int int
rpc_unlink(char *path) rpc_unlink(struct dentry *dentry)
{ {
struct nameidata nd; struct dentry *parent;
struct dentry *dentry;
struct inode *dir; struct inode *dir;
int error; int error = 0;
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;
}
d_drop(dentry); d_drop(dentry);
if (dentry->d_inode) { if (dentry->d_inode) {
rpc_close_pipes(dentry->d_inode); rpc_close_pipes(dentry->d_inode);
...@@ -769,9 +762,8 @@ rpc_unlink(char *path) ...@@ -769,9 +762,8 @@ rpc_unlink(char *path)
} }
dput(dentry); dput(dentry);
inode_dir_notify(dir, DN_DELETE); inode_dir_notify(dir, DN_DELETE);
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