Whamcloud - gitweb
branch: b_new_cmd
authorericm <ericm>
Fri, 10 Nov 2006 00:31:44 +0000 (00:31 +0000)
committerericm <ericm>
Fri, 10 Nov 2006 00:31:44 +0000 (00:31 +0000)
b=11185
only register gss policy after it is ready.

lustre/ptlrpc/gss/sec_gss.c

index d1b240f..1205896 100644 (file)
@@ -81,7 +81,6 @@ static struct ptlrpc_cli_ctx * gss_sec_create_ctx(struct ptlrpc_sec *sec,
                                                   struct vfs_cred *vcred);
 static void gss_sec_destroy_ctx(struct ptlrpc_sec *sec,
                                 struct ptlrpc_cli_ctx *ctx);
-static __gss_mod_initialized = 0;
 /********************************************
  * wire data swabber                        *
  ********************************************/
@@ -2149,8 +2148,6 @@ int gss_svc_accept(struct ptlrpc_request *req)
         int                     rc;
         ENTRY;
 
-        LASSERTF((__gss_mod_initialized == 1),
-                 "not initialized %d\n", __gss_mod_initialized);
         LASSERT(req->rq_reqbuf);
         LASSERT(req->rq_svc_ctx == NULL);
 
@@ -2558,13 +2555,9 @@ int __init sptlrpc_gss_init(void)
 {
         int rc;
 
-        rc = sptlrpc_register_policy(&gss_policy);
-        if (rc)
-                return rc;
-
         rc = gss_init_lproc();
         if (rc)
-                goto out_type;
+                return rc;
 
         rc = gss_init_upcall();
         if (rc)
@@ -2574,23 +2567,30 @@ int __init sptlrpc_gss_init(void)
         if (rc)
                 goto out_upcall;
 
-        __gss_mod_initialized = 1;
+        /*
+         * register policy after all other stuff be intialized, because it
+         * might be in used immediately after the registration.
+         */
+        rc = sptlrpc_register_policy(&gss_policy);
+        if (rc)
+                goto out_kerberos;
+
         return 0;
+out_kerberos:
+        cleanup_kerberos_module();
 out_upcall:
         gss_exit_upcall();
 out_lproc:
         gss_exit_lproc();
-out_type:
-        sptlrpc_unregister_policy(&gss_policy);
         return rc;
 }
 
 static void __exit sptlrpc_gss_exit(void)
 {
+        sptlrpc_unregister_policy(&gss_policy);
         cleanup_kerberos_module();
         gss_exit_upcall();
         gss_exit_lproc();
-        sptlrpc_unregister_policy(&gss_policy);
 }
 
 MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");