SUNRPC: make rpc_unlink() take a dentry argument instead of a path
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 31 Jul 2006 21:11:48 +0000 (14:11 -0700)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 24 Aug 2006 19:50:07 +0000 (15:50 -0400)
Signe-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
(cherry picked from 88bf6d811b01a4be7fd507d18bf5f1c527989089 commit)

fs/nfs/idmap.c
include/linux/sunrpc/rpc_pipe_fs.h
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/rpc_pipe.c

index b81e7ed3c9022536c957f0811ec612e4f6bbf29f..df0be12143589546e3568d0ffffa19265562f9bb 100644 (file)
@@ -130,9 +130,8 @@ nfs_idmap_delete(struct nfs4_client *clp)
 
        if (!idmap)
                return;
+       rpc_unlink(idmap->idmap_dentry);
        dput(idmap->idmap_dentry);
-       idmap->idmap_dentry = NULL;
-       rpc_unlink(idmap->idmap_path);
        clp->cl_idmap = NULL;
        kfree(idmap);
 }
index 2c2189cb30aab2012e4ab2082247aba3a9f5f5b7..04d2767d5ef7b7d34abffd5ec075f4c3a0f7ba60 100644 (file)
@@ -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 int rpc_rmdir(char *);
 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 void rpc_put_mount(void);
 
index 4a9aa9393b975eb138b0853029695c325aecb4f4..beaa7b848246311f2d7b616192a16d36ee41cc5a 100644 (file)
@@ -718,7 +718,7 @@ gss_destroy(struct rpc_auth *auth)
                auth, auth->au_flavor);
 
        gss_auth = container_of(auth, struct gss_auth, rpc_auth);
-       rpc_unlink(gss_auth->path);
+       rpc_unlink(gss_auth->dentry);
        dput(gss_auth->dentry);
        gss_auth->dentry = NULL;
        gss_mech_put(gss_auth->mech);
index a3bd2db2e024d36112394766e42166b0dbb9b0b2..9144f2767b661aafe89f87cda5d6f1828db3ce55 100644 (file)
@@ -746,22 +746,15 @@ err_dput:
 }
 
 int
-rpc_unlink(char *path)
+rpc_unlink(struct dentry *dentry)
 {
-       struct nameidata nd;
-       struct dentry *dentry;
+       struct dentry *parent;
        struct inode *dir;
-       int error;
+       int error = 0;
 
-       if ((error = rpc_lookup_parent(path, &nd)) != 0)
-               return error;
-       dir = nd.dentry->d_inode;
+       parent = dget_parent(dentry);
+       dir = parent->d_inode;
        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);
        if (dentry->d_inode) {
                rpc_close_pipes(dentry->d_inode);
@@ -769,9 +762,8 @@ rpc_unlink(char *path)
        }
        dput(dentry);
        inode_dir_notify(dir, DN_DELETE);
-out_release:
        mutex_unlock(&dir->i_mutex);
-       rpc_release_path(&nd);
+       dput(parent);
        return error;
 }