Some errno values differ across platforms. So if we return things like
-EINPROGRESS from one node it can get misinterpreted or rejected on
another one.
This patch fixes up the errno values passed on the wire so that they
match the x86 ones (so as not to break the protocol), and re-instates
the platform-specific ones at the other end.
Many thanks to Fabio for testing this patch.
Signed-Off-By: Patrick Caulfield <[EMAIL PROTECTED]
Signed-off-by: Fabio M. Di Nitto <[EMAIL PROTECTED]>
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index ec61bba..3c3d54d 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -220,6 +220,15 @@ struct dlm_args {
#define DLM_IFL_USER 0x00000001
#define DLM_IFL_ORPHAN 0x00000002
+
+/* arch-independant errno values */
+
+#define DLM_ERRNO_EINPROGRESS 115
+#define DLM_ERRNO_ETIMEDOUT 110
+#define DLM_ERRNO_EDEADLK 35
+#define DLM_ERRNO_EOPNOTSUPP 95
+
+
struct dlm_lkb {
struct dlm_rsb *lkb_resource; /* the rsb */
struct kref lkb_ref;
diff --git a/fs/dlm/util.c b/fs/dlm/util.c
index 963889c..901976a 100644
--- a/fs/dlm/util.c
+++ b/fs/dlm/util.c
@@ -36,6 +36,22 @@ void dlm_message_out(struct dlm_message *ms)
header_out(hd);
+ /* Use arch-independant errno values on the wire */
+ switch (ms->m_result) {
+ case -EINPROGRESS:
+ ms->m_result = -DLM_ERRNO_EINPROGRESS;
+ break;
+ case -ETIMEDOUT:
+ ms->m_result = -DLM_ERRNO_ETIMEDOUT;
+ break;
+ case -EDEADLK:
+ ms->m_result = -DLM_ERRNO_EDEADLK;
+ break;
+ case -EOPNOTSUPP:
+ ms->m_result = -DLM_ERRNO_EOPNOTSUPP;
+ break;
+ }
+
ms->m_type = cpu_to_le32(ms->m_type);
ms->m_nodeid = cpu_to_le32(ms->m_nodeid);
ms->m_pid = cpu_to_le32(ms->m_pid);
@@ -80,6 +96,21 @@ void dlm_message_in(struct dlm_message *ms)
ms->m_bastmode = le32_to_cpu(ms->m_bastmode);
ms->m_asts = le32_to_cpu(ms->m_asts);
ms->m_result = le32_to_cpu(ms->m_result);
+
+ switch (ms->m_result) {
+ case -DLM_ERRNO_EINPROGRESS:
+ ms->m_result = -EINPROGRESS;
+ break;
+ case -DLM_ERRNO_ETIMEDOUT:
+ ms->m_result = -ETIMEDOUT;
+ break;
+ case -DLM_ERRNO_EDEADLK:
+ ms->m_result = -EDEADLK;
+ break;
+ case -DLM_ERRNO_EOPNOTSUPP:
+ ms->m_result = -EOPNOTSUPP;
+ break;
+ }
}
static void rcom_lock_out(struct rcom_lock *rl)