Whamcloud - gitweb
branch: b_new_cmd
authorericm <ericm>
Tue, 21 Nov 2006 01:01:31 +0000 (01:01 +0000)
committerericm <ericm>
Tue, 21 Nov 2006 01:01:31 +0000 (01:01 +0000)
more fix to gss module loading: waiting init channel be opened in gss
module itself.

lustre/ptlrpc/gss/gss_svc_upcall.c
lustre/ptlrpc/sec.c

index 776ae06..ce49c96 100644 (file)
@@ -956,8 +956,28 @@ void gss_svc_upcall_destroy_ctx(struct gss_svc_ctx *ctx)
 
 int __init gss_svc_init_upcall(void)
 {
-        cache_register(&rsc_cache);
+        int     i;
+
         cache_register(&rsi_cache);
+        cache_register(&rsc_cache);
+
+        /* FIXME this looks stupid. we intend to give lsvcgssd a chance to open
+         * the init upcall channel, otherwise there's big chance that the first
+         * upcall issued before the channel be opened thus nfsv4 cache code will
+         * drop the request direclty, thus lead to unnecessary recovery time.
+         * here we wait at miximum 1.5 seconds.
+         */
+        for (i = 0; i < 6; i++) {
+                if (atomic_read(&rsi_cache.readers) > 0)
+                        break;
+                set_current_state(TASK_UNINTERRUPTIBLE);
+                LASSERT(HZ >= 4);
+                schedule_timeout(HZ / 4);
+        }
+
+        if (atomic_read(&rsi_cache.readers) == 0)
+                CWARN("init channel is not opened by lsvcgssd, following "
+                      "request might be dropped until lsvcgssd be active\n");
 
         return 0;
 }
index b43df11..15aa3fd 100644 (file)
@@ -133,15 +133,6 @@ again:
                         else
                                 CWARN("module ptlrpc_gss loaded\n");
 
-                        /* this is stupid. we intend to give lsvcgssd a chance
-                         * to open the upcall channel, otherwise there's big
-                         * chance the first upcall issued before the channel be
-                         * opened thus nfsv4 cache code will drop the call
-                         * direclty. FIXME
-                         */
-                        set_current_state(TASK_UNINTERRUPTIBLE);
-                        schedule_timeout(2 * HZ);
-
                         atomic_set(&loaded, 1);
                 }
                 mutex_up(&load_mutex);