aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmcommon.h
diff options
context:
space:
mode:
authorJoel Becker <joel.becker@oracle.com>2008-02-12 17:56:25 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2008-03-10 18:13:54 -0400
commit0f71b7b40f55de909e40fa5ab217a5da3439c7d8 (patch)
tree3afad178b200b0a16e10ccaca2b05da1197034d4 /fs/ocfs2/dlm/dlmcommon.h
parent2af37ce82d199d1d8cd6286f42f37d321627a807 (diff)
ocfs2: Fix endian bug in o2dlm protocol negotiation.
struct dlm_query_join_packet is made up of four one-byte fields. They are effectively in big-endian order already. However, little-endian machines swap them before putting the packet on the wire (because query_join's response is a status, and that status is treated as a u32 on the wire). Thus, a big-endian and little-endian machines will treat this structure differently. The solution is to have little-endian machines swap the structure when converting from the structure to the u32 representation. Signed-off-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmcommon.h')
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 9843ee17ea27..1f939631ab74 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -602,17 +602,19 @@ enum dlm_query_join_response_code {
602 JOIN_PROTOCOL_MISMATCH, 602 JOIN_PROTOCOL_MISMATCH,
603}; 603};
604 604
605struct dlm_query_join_packet {
606 u8 code; /* Response code. dlm_minor and fs_minor
607 are only valid if this is JOIN_OK */
608 u8 dlm_minor; /* The minor version of the protocol the
609 dlm is speaking. */
610 u8 fs_minor; /* The minor version of the protocol the
611 filesystem is speaking. */
612 u8 reserved;
613};
614
605union dlm_query_join_response { 615union dlm_query_join_response {
606 u32 intval; 616 u32 intval;
607 struct { 617 struct dlm_query_join_packet packet;
608 u8 code; /* Response code. dlm_minor and fs_minor
609 are only valid if this is JOIN_OK */
610 u8 dlm_minor; /* The minor version of the protocol the
611 dlm is speaking. */
612 u8 fs_minor; /* The minor version of the protocol the
613 filesystem is speaking. */
614 u8 reserved;
615 } packet;
616}; 618};
617 619
618struct dlm_lock_request 620struct dlm_lock_request