Whamcloud - gitweb
LU-4012 gss: upcall fails due to removed generic cache calls 70/7770/5
authorThomas Stibor <thomas@stibor.net>
Thu, 17 Oct 2013 08:10:01 +0000 (10:10 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 2 Nov 2013 00:56:49 +0000 (00:56 +0000)
With Linux kernel version >= 3.4.X the generic cache registering
routines cache_register(), cache_unregister() are removed.
This effects the GSS upcall routines for the Kerberos
support in Lustre. Before (Linux kernel <= 3.2.X) the
generic routines were coded as:
int cache_register(struct cache_detail *cd)
{
        return cache_register_net(cd, &init_net);
}
void cache_unregister(struct cache_detail *cd)
{
        cache_unregister_net(cd, &init_net);
}
To keep compatibility with former kernel versions,
cache_register_net() and cache_unregister_net() can
be applied instead, rather than the old and
removed cache_register() and cache_unregister().

Signed-off-by: Thomas Stibor <thomas@stibor.net>
Change-Id: I3eb012a1883c463ecafe3646e7e706ab96d91c5c
Reviewed-on: http://review.whamcloud.com/7770
Tested-by: Jenkins
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andrew Korty <ajk@iu.edu>
lustre/ptlrpc/gss/gss_svc_upcall.c

index eb5e493..7fcc3e8 100644 (file)
@@ -1059,26 +1059,32 @@ void gss_svc_upcall_destroy_ctx(struct gss_svc_ctx *ctx)
 
 int __init gss_init_svc_upcall(void)
 {
-       int     i;
+       int     i, rc;
 
        spin_lock_init(&__ctx_index_lock);
-        /*
-         * this helps reducing context index confliction. after server reboot,
-         * conflicting request from clients might be filtered out by initial
-         * sequence number checking, thus no chance to sent error notification
-         * back to clients.
-         */
-        cfs_get_random_bytes(&__ctx_index, sizeof(__ctx_index));
-
-
-        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. */
+       /*
+        * this helps reducing context index confliction. after server reboot,
+        * conflicting request from clients might be filtered out by initial
+        * sequence number checking, thus no chance to sent error notification
+        * back to clients.
+        */
+       cfs_get_random_bytes(&__ctx_index, sizeof(__ctx_index));
+
+       rc = cache_register_net(&rsi_cache, &init_net);
+       if (rc != 0)
+               return rc;
+
+       rc = cache_register_net(&rsc_cache, &init_net);
+       if (rc != 0) {
+               cache_unregister_net(&rsi_cache, &init_net);
+               return rc;
+       }
+
+       /* 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;
@@ -1087,18 +1093,18 @@ int __init gss_init_svc_upcall(void)
                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 is active\n");
+       if (atomic_read(&rsi_cache.readers) == 0)
+               CWARN("Init channel is not opened by lsvcgssd, following "
+                     "request might be dropped until lsvcgssd is active\n");
 
-        return 0;
+       return 0;
 }
 
 void __exit gss_exit_svc_upcall(void)
 {
-        cache_purge(&rsi_cache);
-        cache_unregister(&rsi_cache);
+       cache_purge(&rsi_cache);
+       cache_unregister_net(&rsi_cache, &init_net);
 
-        cache_purge(&rsc_cache);
-        cache_unregister(&rsc_cache);
+       cache_purge(&rsc_cache);
+       cache_unregister_net(&rsc_cache, &init_net);
 }