aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-01-25 02:34:00 -0500
committerDavid Teigland <teigland@redhat.com>2008-02-04 02:23:43 -0500
commit93ff2971e99c90d1c4d39d242ef6050d2dc853d3 (patch)
tree215da29d7087d4b3875285b85043056397dd050b
parent163a1859ec6c4c33547bf4613efabf52031566aa (diff)
dlm: do not byteswap rcom_config
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--fs/dlm/dlm_internal.h6
-rw-r--r--fs/dlm/rcom.c15
-rw-r--r--fs/dlm/util.c20
3 files changed, 11 insertions, 30 deletions
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index e73b988995f5..187a5b5b28b6 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -410,9 +410,9 @@ union dlm_packet {
410}; 410};
411 411
412struct rcom_config { 412struct rcom_config {
413 uint32_t rf_lvblen; 413 __le32 rf_lvblen;
414 uint32_t rf_lsflags; 414 __le32 rf_lsflags;
415 uint64_t rf_unused; 415 __le64 rf_unused;
416}; 416};
417 417
418struct rcom_lock { 418struct rcom_lock {
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 86c1ab99208e..fb0776201d73 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -78,8 +78,8 @@ static void send_rcom(struct dlm_ls *ls, struct dlm_mhandle *mh,
78 78
79static void make_config(struct dlm_ls *ls, struct rcom_config *rf) 79static void make_config(struct dlm_ls *ls, struct rcom_config *rf)
80{ 80{
81 rf->rf_lvblen = ls->ls_lvblen; 81 rf->rf_lvblen = cpu_to_le32(ls->ls_lvblen);
82 rf->rf_lsflags = ls->ls_exflags; 82 rf->rf_lsflags = cpu_to_le32(ls->ls_exflags);
83} 83}
84 84
85static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) 85static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
@@ -93,11 +93,12 @@ static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
93 return -EPROTO; 93 return -EPROTO;
94 } 94 }
95 95
96 if (rf->rf_lvblen != ls->ls_lvblen || 96 if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen ||
97 rf->rf_lsflags != ls->ls_exflags) { 97 le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) {
98 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x", 98 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",
99 ls->ls_lvblen, ls->ls_exflags, 99 ls->ls_lvblen, ls->ls_exflags, nodeid,
100 nodeid, rf->rf_lvblen, rf->rf_lsflags); 100 le32_to_cpu(rf->rf_lvblen),
101 le32_to_cpu(rf->rf_lsflags));
101 return -EPROTO; 102 return -EPROTO;
102 } 103 }
103 return 0; 104 return 0;
@@ -401,7 +402,7 @@ int dlm_send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
401 rc->rc_result = -ESRCH; 402 rc->rc_result = -ESRCH;
402 403
403 rf = (struct rcom_config *) rc->rc_buf; 404 rf = (struct rcom_config *) rc->rc_buf;
404 rf->rf_lvblen = -1; 405 rf->rf_lvblen = cpu_to_le32(~0U);
405 406
406 dlm_rcom_out(rc); 407 dlm_rcom_out(rc);
407 dlm_lowcomms_commit_buffer(mh); 408 dlm_lowcomms_commit_buffer(mh);
diff --git a/fs/dlm/util.c b/fs/dlm/util.c
index d3ed6da0b650..e36520af7cc0 100644
--- a/fs/dlm/util.c
+++ b/fs/dlm/util.c
@@ -131,22 +131,8 @@ void dlm_message_in(struct dlm_message *ms)
131 ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result)); 131 ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result));
132} 132}
133 133
134static void rcom_config_out(struct rcom_config *rf)
135{
136 rf->rf_lvblen = cpu_to_le32(rf->rf_lvblen);
137 rf->rf_lsflags = cpu_to_le32(rf->rf_lsflags);
138}
139
140static void rcom_config_in(struct rcom_config *rf)
141{
142 rf->rf_lvblen = le32_to_cpu(rf->rf_lvblen);
143 rf->rf_lsflags = le32_to_cpu(rf->rf_lsflags);
144}
145
146void dlm_rcom_out(struct dlm_rcom *rc) 134void dlm_rcom_out(struct dlm_rcom *rc)
147{ 135{
148 int type = rc->rc_type;
149
150 header_out(&rc->rc_header); 136 header_out(&rc->rc_header);
151 137
152 rc->rc_type = cpu_to_le32(rc->rc_type); 138 rc->rc_type = cpu_to_le32(rc->rc_type);
@@ -154,9 +140,6 @@ void dlm_rcom_out(struct dlm_rcom *rc)
154 rc->rc_id = cpu_to_le64(rc->rc_id); 140 rc->rc_id = cpu_to_le64(rc->rc_id);
155 rc->rc_seq = cpu_to_le64(rc->rc_seq); 141 rc->rc_seq = cpu_to_le64(rc->rc_seq);
156 rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply); 142 rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply);
157
158 if (type == DLM_RCOM_STATUS_REPLY)
159 rcom_config_out((struct rcom_config *) rc->rc_buf);
160} 143}
161 144
162void dlm_rcom_in(struct dlm_rcom *rc) 145void dlm_rcom_in(struct dlm_rcom *rc)
@@ -168,7 +151,4 @@ void dlm_rcom_in(struct dlm_rcom *rc)
168 rc->rc_id = le64_to_cpu(rc->rc_id); 151 rc->rc_id = le64_to_cpu(rc->rc_id);
169 rc->rc_seq = le64_to_cpu(rc->rc_seq); 152 rc->rc_seq = le64_to_cpu(rc->rc_seq);
170 rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply); 153 rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply);
171
172 if (rc->rc_type == DLM_RCOM_STATUS_REPLY)
173 rcom_config_in((struct rcom_config *) rc->rc_buf);
174} 154}