From 6b308bb995383e9fa1e2ef73e27c60518e6639bd Mon Sep 17 00:00:00 2001 From: Thomas Stibor Date: Thu, 17 Oct 2013 10:10:01 +0200 Subject: [PATCH] LU-4012 gss: upcall fails due to removed generic cache calls 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 Change-Id: I3eb012a1883c463ecafe3646e7e706ab96d91c5c Reviewed-on: http://review.whamcloud.com/7770 Tested-by: Jenkins Reviewed-by: Nathaniel Clark Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Andrew Korty --- lustre/ptlrpc/gss/gss_svc_upcall.c | 58 +++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index eb5e493..7fcc3e8 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -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); } -- 1.8.3.1