From: Bobi Jam Date: Sat, 5 Nov 2011 07:55:39 +0000 (+0800) Subject: LU-867 ptlrpc: Resolve section mismatch X-Git-Tag: 2.1.54~36 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=30d23e8d36d8b0b4d2571e7801e3643b0e7ab22e;hp=82b79742c8e86650d1441828ef727c21e88faff8 LU-867 ptlrpc: Resolve section mismatch The __init and __exit attributes appear to have been over used for the ptlrpc module. They should only be attached to ptlrpc_init and ptlrpc_exit respectively and those functions should call the required cleanup functions. By using the attributes too broadly the following section mismatch warning with be hit. This indentifies cases where your calling an __exit function from an __init function which is in the wrong section. WARNING: ~/src/git/lustre/lustre/ptlrpc/ptlrpc.o(.init.text+0x354): Section mismatch in reference from the function ptlrpc_init() to the function .exit.text:sptlrpc_fini() The function __init ptlrpc_init() references a function __exit sptlrpc_fini(). This is often seen when error handling in the init function uses functionality in the exit path. The fix is often to remove the __exit annotation of sptlrpc_fini() so it may be used outside an exit section. Signed-off-by: Brian Behlendorf Signed-off-by: Bobi Jam Change-Id: I94a4cb5fb7deea41fce5ee939470dc2e40908f98 Reviewed-on: http://review.whamcloud.com/1653 Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Tested-by: Hudson Reviewed-by: Oleg Drokin --- diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index d009a1f..da9a6f7 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2614,7 +2614,7 @@ static int ldlm_cleanup(void) RETURN(0); } -int __init ldlm_init(void) +int ldlm_init(void) { cfs_init_mutex(&ldlm_ref_sem); cfs_init_mutex(ldlm_namespace_lock(LDLM_NAMESPACE_SERVER)); @@ -2647,7 +2647,7 @@ int __init ldlm_init(void) return 0; } -void __exit ldlm_exit(void) +void ldlm_exit(void) { int rc; if (ldlm_refcount) diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 8ab5019..ecb64d0 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -143,8 +143,8 @@ int sptlrpc_conf_init(void); void sptlrpc_conf_fini(void); /* sec.c */ -int __init sptlrpc_init(void); -void __exit sptlrpc_fini(void); +int sptlrpc_init(void); +void sptlrpc_fini(void); /* recov_thread.c */ int llog_recov_init(void); diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 62af35c..3487211 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -2499,7 +2499,7 @@ EXPORT_SYMBOL(sptlrpc_flavor_has_bulk); * initialize/finalize * ****************************************/ -int __init sptlrpc_init(void) +int sptlrpc_init(void) { int rc; @@ -2545,7 +2545,7 @@ out: return rc; } -void __exit sptlrpc_fini(void) +void sptlrpc_fini(void) { sptlrpc_lproc_fini(); sptlrpc_plain_fini();