From: James Simmons Date: Wed, 4 Dec 2013 20:03:38 +0000 (-0500) Subject: LU-4307 kerberos: fix __exit usage and unknown symbol errors X-Git-Tag: 2.5.53~37 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=e975b1ce94ab7e626fbb4807032e0f72d6a3d42b LU-4307 kerberos: fix __exit usage and unknown symbol errors For linux all functions marked with __exit should not be called as a cleanup function in the module init functions. This patch removes __exit from the gss module exit functions that are being used as cleanup in the module init function. The second issue addressed is the unknown symbols due to gss_[init/exit]_keyring being called when HAVE_GSS_KEYRING is not defined. Signed-off-by: James Simmons Change-Id: I2de7a3ade47f585f5ec1634ee55c1d2ce56f2921 Reviewed-on: http://review.whamcloud.com/8481 Tested-by: Jenkins Reviewed-by: Nathaniel Clark Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Thomas Stibor Reviewed-by: Andrew Korty --- diff --git a/lustre/ptlrpc/gss/gss_cli_upcall.c b/lustre/ptlrpc/gss/gss_cli_upcall.c index b36c99a..086f7b4 100644 --- a/lustre/ptlrpc/gss/gss_cli_upcall.c +++ b/lustre/ptlrpc/gss/gss_cli_upcall.c @@ -446,6 +446,6 @@ int __init gss_init_cli_upcall(void) return 0; } -void __exit gss_exit_cli_upcall(void) +void gss_exit_cli_upcall(void) { } diff --git a/lustre/ptlrpc/gss/gss_internal.h b/lustre/ptlrpc/gss/gss_internal.h index 06f519b..301413e 100644 --- a/lustre/ptlrpc/gss/gss_internal.h +++ b/lustre/ptlrpc/gss/gss_internal.h @@ -427,12 +427,22 @@ int gss_cli_ctx_fini_common(struct ptlrpc_sec *sec, void gss_cli_ctx_flags2str(unsigned long flags, char *buf, int bufsize); /* gss_keyring.c */ +#ifndef HAVE_GSS_KEYRING +static inline int __init gss_init_keyring(void) { return 0; } +static inline void __exit gss_exit_keyring(void) { return; } +#else int __init gss_init_keyring(void); void __exit gss_exit_keyring(void); +#endif /* gss_pipefs.c */ +#ifndef HAVE_GSS_PIPEFS +static inline int __init gss_init_pipefs(void) { return 0; } +static inline void __exit gss_exit_pipefs(void) { return; } +#else int __init gss_init_pipefs(void); void __exit gss_exit_pipefs(void); +#endif /* gss_bulk.c */ int gss_cli_prep_bulk(struct ptlrpc_request *req, @@ -450,10 +460,6 @@ int gss_svc_unwrap_bulk(struct ptlrpc_request *req, int gss_svc_wrap_bulk(struct ptlrpc_request *req, struct ptlrpc_bulk_desc *desc); -/* gss_mech_switch.c */ -int init_kerberos_module(void); -void cleanup_kerberos_module(void); - /* gss_generic_token.c */ int g_token_size(rawobj_t *mech, unsigned int body_size); void g_make_token_header(rawobj_t *mech, int body_size, unsigned char **buf); @@ -466,7 +472,7 @@ int gss_do_ctx_init_rpc(char *buffer, unsigned long count); int gss_do_ctx_fini_rpc(struct gss_cli_ctx *gctx); int __init gss_init_cli_upcall(void); -void __exit gss_exit_cli_upcall(void); +void gss_exit_cli_upcall(void); /* gss_svc_upcall.c */ __u64 gss_get_next_ctx_index(void); @@ -489,18 +495,18 @@ void gss_svc_upcall_put_ctx(struct gss_svc_ctx *ctx); void gss_svc_upcall_destroy_ctx(struct gss_svc_ctx *ctx); int __init gss_init_svc_upcall(void); -void __exit gss_exit_svc_upcall(void); +void gss_exit_svc_upcall(void); /* lproc_gss.c */ void gss_stat_oos_record_cli(int behind); void gss_stat_oos_record_svc(int phase, int replay); int __init gss_init_lproc(void); -void __exit gss_exit_lproc(void); +void gss_exit_lproc(void); /* gss_krb5_mech.c */ int __init init_kerberos_module(void); -void __exit cleanup_kerberos_module(void); +void cleanup_kerberos_module(void); /* debug */ diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index bd1114f..3cd3be5 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -1782,7 +1782,7 @@ int __init init_kerberos_module(void) return status; } -void __exit cleanup_kerberos_module(void) +void cleanup_kerberos_module(void) { lgss_mech_unregister(&gss_kerberos_mech); } diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 7fcc3e8..90967ed 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -1100,7 +1100,7 @@ int __init gss_init_svc_upcall(void) return 0; } -void __exit gss_exit_svc_upcall(void) +void gss_exit_svc_upcall(void) { cache_purge(&rsi_cache); cache_unregister_net(&rsi_cache, &init_net); diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index 74eb470..043a683 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -2874,21 +2874,16 @@ int __init sptlrpc_gss_init(void) if (rc) goto out_kerberos; -#ifdef HAVE_GSS_PIPEFS rc = gss_init_pipefs(); if (rc) goto out_keyring; -#endif gss_init_at_reply_offset(); return 0; -#ifdef HAVE_GSS_PIPEFS out_keyring: gss_exit_keyring(); -#endif - out_kerberos: cleanup_kerberos_module(); out_svc_upcall: @@ -2903,9 +2898,7 @@ out_lproc: static void __exit sptlrpc_gss_exit(void) { gss_exit_keyring(); -#ifdef HAVE_GSS_PIPEFS gss_exit_pipefs(); -#endif cleanup_kerberos_module(); gss_exit_svc_upcall(); gss_exit_cli_upcall();