Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dlm: do not byteswap rcom_config

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Teigland <teigland@redhat.com>

authored by

Al Viro and committed by
David Teigland
93ff2971 163a1859

+11 -30
+3 -3
fs/dlm/dlm_internal.h
··· 410 410 }; 411 411 412 412 struct rcom_config { 413 - uint32_t rf_lvblen; 414 - uint32_t rf_lsflags; 415 - uint64_t rf_unused; 413 + __le32 rf_lvblen; 414 + __le32 rf_lsflags; 415 + __le64 rf_unused; 416 416 }; 417 417 418 418 struct rcom_lock {
+8 -7
fs/dlm/rcom.c
··· 78 78 79 79 static void make_config(struct dlm_ls *ls, struct rcom_config *rf) 80 80 { 81 - rf->rf_lvblen = ls->ls_lvblen; 82 - rf->rf_lsflags = ls->ls_exflags; 81 + rf->rf_lvblen = cpu_to_le32(ls->ls_lvblen); 82 + rf->rf_lsflags = cpu_to_le32(ls->ls_exflags); 83 83 } 84 84 85 85 static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) ··· 93 93 return -EPROTO; 94 94 } 95 95 96 - if (rf->rf_lvblen != ls->ls_lvblen || 97 - rf->rf_lsflags != ls->ls_exflags) { 96 + if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen || 97 + le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) { 98 98 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x", 99 - ls->ls_lvblen, ls->ls_exflags, 100 - nodeid, rf->rf_lvblen, rf->rf_lsflags); 99 + ls->ls_lvblen, ls->ls_exflags, nodeid, 100 + le32_to_cpu(rf->rf_lvblen), 101 + le32_to_cpu(rf->rf_lsflags)); 101 102 return -EPROTO; 102 103 } 103 104 return 0; ··· 402 401 rc->rc_result = -ESRCH; 403 402 404 403 rf = (struct rcom_config *) rc->rc_buf; 405 - rf->rf_lvblen = -1; 404 + rf->rf_lvblen = cpu_to_le32(~0U); 406 405 407 406 dlm_rcom_out(rc); 408 407 dlm_lowcomms_commit_buffer(mh);
-20
fs/dlm/util.c
··· 131 131 ms->m_result = from_dlm_errno(le32_to_cpu(ms->m_result)); 132 132 } 133 133 134 - static 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 - 140 - static 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 - 146 134 void dlm_rcom_out(struct dlm_rcom *rc) 147 135 { 148 - int type = rc->rc_type; 149 - 150 136 header_out(&rc->rc_header); 151 137 152 138 rc->rc_type = cpu_to_le32(rc->rc_type); ··· 140 154 rc->rc_id = cpu_to_le64(rc->rc_id); 141 155 rc->rc_seq = cpu_to_le64(rc->rc_seq); 142 156 rc->rc_seq_reply = cpu_to_le64(rc->rc_seq_reply); 143 - 144 - if (type == DLM_RCOM_STATUS_REPLY) 145 - rcom_config_out((struct rcom_config *) rc->rc_buf); 146 157 } 147 158 148 159 void dlm_rcom_in(struct dlm_rcom *rc) ··· 151 168 rc->rc_id = le64_to_cpu(rc->rc_id); 152 169 rc->rc_seq = le64_to_cpu(rc->rc_seq); 153 170 rc->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply); 154 - 155 - if (rc->rc_type == DLM_RCOM_STATUS_REPLY) 156 - rcom_config_in((struct rcom_config *) rc->rc_buf); 157 171 }