SUNRPC: Fix dentry refcounting issues with users of rpc_pipefs
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 14 Aug 2006 17:11:15 +0000 (13:11 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 24 Aug 2006 19:50:51 +0000 (15:50 -0400)
rpc_unlink() and rpc_rmdir() will dput the dentry reference for you.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
(cherry picked from a05a57effa71a1f67ccbfc52335c10c8b85f3f6a commit)

fs/nfs/idmap.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/clnt.c

index df0be12143589546e3568d0ffffa19265562f9bb..07a5dd57646e3c06ef9aec1c3663e676c7852d0a 100644 (file)
@@ -131,7 +131,6 @@ nfs_idmap_delete(struct nfs4_client *clp)
        if (!idmap)
                return;
        rpc_unlink(idmap->idmap_dentry);
-       dput(idmap->idmap_dentry);
        clp->cl_idmap = NULL;
        kfree(idmap);
 }
index beaa7b848246311f2d7b616192a16d36ee41cc5a..ef1cf5b476c8c1b60f3eb17c1de548fbeae3bedf 100644 (file)
@@ -719,7 +719,6 @@ gss_destroy(struct rpc_auth *auth)
 
        gss_auth = container_of(auth, struct gss_auth, rpc_auth);
        rpc_unlink(gss_auth->dentry);
-       dput(gss_auth->dentry);
        gss_auth->dentry = NULL;
        gss_mech_put(gss_auth->mech);
 
index d307556872dbfdf6aa67ec85e5883e5919e5946b..d9eac706910188d08aacac42757883df1b1fd2ce 100644 (file)
@@ -184,7 +184,6 @@ rpc_new_client(struct rpc_xprt *xprt, char *servname,
 out_no_auth:
        if (!IS_ERR(clnt->cl_dentry)) {
                rpc_rmdir(clnt->cl_dentry);
-               dput(clnt->cl_dentry);
                rpc_put_mount();
        }
 out_no_path:
@@ -251,10 +250,8 @@ rpc_clone_client(struct rpc_clnt *clnt)
        new->cl_autobind = 0;
        new->cl_oneshot = 0;
        new->cl_dead = 0;
-       if (!IS_ERR(new->cl_dentry)) {
+       if (!IS_ERR(new->cl_dentry))
                dget(new->cl_dentry);
-               rpc_get_mount();
-       }
        rpc_init_rtt(&new->cl_rtt_default, clnt->cl_xprt->timeout.to_initval);
        if (new->cl_auth)
                atomic_inc(&new->cl_auth->au_count);
@@ -317,11 +314,15 @@ rpc_destroy_client(struct rpc_clnt *clnt)
                clnt->cl_auth = NULL;
        }
        if (clnt->cl_parent != clnt) {
+               if (!IS_ERR(clnt->cl_dentry))
+                       dput(clnt->cl_dentry);
                rpc_destroy_client(clnt->cl_parent);
                goto out_free;
        }
-       if (!IS_ERR(clnt->cl_dentry))
+       if (!IS_ERR(clnt->cl_dentry)) {
                rpc_rmdir(clnt->cl_dentry);
+               rpc_put_mount();
+       }
        if (clnt->cl_xprt) {
                xprt_destroy(clnt->cl_xprt);
                clnt->cl_xprt = NULL;
@@ -331,10 +332,6 @@ rpc_destroy_client(struct rpc_clnt *clnt)
 out_free:
        rpc_free_iostats(clnt->cl_metrics);
        clnt->cl_metrics = NULL;
-       if (!IS_ERR(clnt->cl_dentry)) {
-               dput(clnt->cl_dentry);
-               rpc_put_mount();
-       }
        kfree(clnt);
        return 0;
 }