Whamcloud - gitweb
New tag 2.15.63
[fs/lustre-release.git] / lustre / ptlrpc / errno.c
index 96f6f75..987803b 100644 (file)
 /*
  * Copyright (C) 2011 FUJITSU LIMITED.  All rights reserved.
  *
- * Copyright (c) 2013, 2014, Intel Corporation.
+ * Copyright (c) 2013, Intel Corporation.
  */
 
 #include <libcfs/libcfs.h>
-#include <lustre/lustre_errno.h>
+#include <lustre_errno.h>
 
 #ifdef LUSTRE_TRANSLATE_ERRNOS
+#include <lustre_dlm.h>
 
 /*
  * The two translation tables below must define a one-to-one mapping between
  * host and network errnos.
  *
- * EWOULDBLOCK is equal to EAGAIN on all architectures except for parisc, which
- * appears irrelevant.  Thus, existing references to EWOULDBLOCK are fine.
+ * EAGAIN is equal to EAGAIN on all architectures except for parisc, which
+ * appears irrelevant.  Thus, existing references to EAGAIN are fine.
  *
  * EDEADLOCK is equal to EDEADLK on x86 but not on sparc, at least.  A sparc
  * host has no context-free way to determine if a LUSTRE_EDEADLK represents an
@@ -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)