From: Ann Koehler Date: Tue, 13 Nov 2018 16:47:20 +0000 (-0500) Subject: LU-9793 ptlrpc: Do not map unrecognized ELDLM errnos to EIO X-Git-Tag: 2.12.0-RC1~22 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=641e1d546742aa355ef51bee6359ee82994d5735;p=fs%2Flustre-release.git LU-9793 ptlrpc: Do not map unrecognized ELDLM errnos to EIO The lustre_errno_hton and lustre_errno_ntoh functions map between host and network error numbers before they are sent over the network. If an errno is unrecognized then it is mapped to EIO. However an optimization for x86 and i386 architectures replaced the functions with macros that simply return the original errno. The result is that x86 and i386 return the original values for ELDLM errnos and all other architectures return EIO. This difference is known to break glimpse lock callback handling which depends on clients responding with ELDLM_NO_LOCK_DATA. The difference in errnos may result in other as yet unidentified bugs. The fix defines mappings for the ELDLM errors that leaves the values unchanged. Error numbers not found in the mapping tables are still mapped to EIO. Cray-bug-id: LUS-6057 Signed-off-by: Ann Koehler Change-Id: I0b4e1e0dc6de065729e18f2381ec9cfc58fe31db Reviewed-on: https://review.whamcloud.com/33471 Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/errno.c b/lustre/ptlrpc/errno.c index 7d58758..a3d31a8 100644 --- a/lustre/ptlrpc/errno.c +++ b/lustre/ptlrpc/errno.c @@ -29,6 +29,7 @@ #include #ifdef LUSTRE_TRANSLATE_ERRNOS +#include /* * The two translation tables below must define a one-to-one mapping between @@ -185,7 +186,20 @@ static int lustre_errno_hton_mapping[] = { [ESERVERFAULT] = LUSTRE_ESERVERFAULT, [EBADTYPE] = LUSTRE_EBADTYPE, [EJUKEBOX] = LUSTRE_EJUKEBOX, - [EIOCBQUEUED] = LUSTRE_EIOCBQUEUED + [EIOCBQUEUED] = LUSTRE_EIOCBQUEUED, + + /* + * The ELDLM errors are Lustre specific errors whose ranges + * lie in the middle of the above system errors. The ELDLM + * numbers must be preserved to avoid LU-9793. + */ + [ELDLM_LOCK_CHANGED] = ELDLM_LOCK_CHANGED, + [ELDLM_LOCK_ABORTED] = ELDLM_LOCK_ABORTED, + [ELDLM_LOCK_REPLACED] = ELDLM_LOCK_REPLACED, + [ELDLM_NO_LOCK_DATA] = ELDLM_NO_LOCK_DATA, + [ELDLM_LOCK_WOULDBLOCK] = ELDLM_LOCK_WOULDBLOCK, + [ELDLM_NAMESPACE_EXISTS]= ELDLM_NAMESPACE_EXISTS, + [ELDLM_BAD_NAMESPACE] = ELDLM_BAD_NAMESPACE }; static int lustre_errno_ntoh_mapping[] = { @@ -331,7 +345,20 @@ static int lustre_errno_ntoh_mapping[] = { [LUSTRE_ESERVERFAULT] = ESERVERFAULT, [LUSTRE_EBADTYPE] = EBADTYPE, [LUSTRE_EJUKEBOX] = EJUKEBOX, - [LUSTRE_EIOCBQUEUED] = EIOCBQUEUED + [LUSTRE_EIOCBQUEUED] = EIOCBQUEUED, + + /* + * The ELDLM errors are Lustre specific errors whose ranges + * lie in the middle of the above system errors. The ELDLM + * numbers must be preserved to avoid LU-9793. + */ + [ELDLM_LOCK_CHANGED] = ELDLM_LOCK_CHANGED, + [ELDLM_LOCK_ABORTED] = ELDLM_LOCK_ABORTED, + [ELDLM_LOCK_REPLACED] = ELDLM_LOCK_REPLACED, + [ELDLM_NO_LOCK_DATA] = ELDLM_NO_LOCK_DATA, + [ELDLM_LOCK_WOULDBLOCK] = ELDLM_LOCK_WOULDBLOCK, + [ELDLM_NAMESPACE_EXISTS] = ELDLM_NAMESPACE_EXISTS, + [ELDLM_BAD_NAMESPACE] = ELDLM_BAD_NAMESPACE }; unsigned int lustre_errno_hton(unsigned int h)