Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1dd17ec693bf4a08b666c2ef76b68ca08ce3c93d
Commit:     1dd17ec693bf4a08b666c2ef76b68ca08ce3c93d
Parent:     5d28dc82074f1e64b22c9424b161abc1f5d6bcdb
Author:     Trond Myklebust <[EMAIL PROTECTED]>
AuthorDate: Tue Jun 26 16:57:41 2007 -0400
Committer:  Trond Myklebust <[EMAIL PROTECTED]>
CommitDate: Tue Jul 10 23:40:36 2007 -0400

    SUNRPC: Allow rpc_auth to run clean up before the rpc_client is destroyed
    
    RPCSEC_GSS needs to be able to send NULL RPC calls to the server in order
    to free up any remaining GSS contexts.
    
    Signed-off-by: Trond Myklebust <[EMAIL PROTECTED]>
---
 net/sunrpc/clnt.c |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 98df44e..28a7894 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -352,10 +352,6 @@ rpc_free_client(struct kref *kref)
 
        dprintk("RPC:       destroying %s client for %s\n",
                        clnt->cl_protname, clnt->cl_server);
-       if (clnt->cl_auth) {
-               rpcauth_release(clnt->cl_auth);
-               clnt->cl_auth = NULL;
-       }
        if (!IS_ERR(clnt->cl_dentry)) {
                rpc_rmdir(clnt->cl_dentry);
                rpc_put_mount();
@@ -376,6 +372,30 @@ out_free:
 }
 
 /*
+ * Free an RPC client
+ */
+static void
+rpc_free_auth(struct kref *kref)
+{
+       struct rpc_clnt *clnt = container_of(kref, struct rpc_clnt, cl_kref);
+
+       if (clnt->cl_auth == NULL) {
+               rpc_free_client(kref);
+               return;
+       }
+
+       /*
+        * Note: RPCSEC_GSS may need to send NULL RPC calls in order to
+        *       release remaining GSS contexts. This mechanism ensures
+        *       that it can do so safely.
+        */
+       kref_init(kref);
+       rpcauth_release(clnt->cl_auth);
+       clnt->cl_auth = NULL;
+       kref_put(kref, rpc_free_client);
+}
+
+/*
  * Release reference to the RPC client
  */
 void
@@ -385,7 +405,7 @@ rpc_release_client(struct rpc_clnt *clnt)
 
        if (list_empty(&clnt->cl_tasks))
                wake_up(&destroy_wait);
-       kref_put(&clnt->cl_kref, rpc_free_client);
+       kref_put(&clnt->cl_kref, rpc_free_auth);
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to