aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/rcom.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/dlm/rcom.c')
-rw-r--r--fs/dlm/rcom.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 5573d8590e58..64ba4929f90b 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -108,6 +108,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid)
108 error = create_rcom(ls, nodeid, DLM_RCOM_STATUS, 0, &rc, &mh); 108 error = create_rcom(ls, nodeid, DLM_RCOM_STATUS, 0, &rc, &mh);
109 if (error) 109 if (error)
110 goto out; 110 goto out;
111 rc->rc_id = ++ls->ls_rcom_seq;
111 112
112 send_rcom(ls, mh, rc); 113 send_rcom(ls, mh, rc);
113 114
@@ -140,19 +141,30 @@ static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in)
140 sizeof(struct rcom_config), &rc, &mh); 141 sizeof(struct rcom_config), &rc, &mh);
141 if (error) 142 if (error)
142 return; 143 return;
144 rc->rc_id = rc_in->rc_id;
143 rc->rc_result = dlm_recover_status(ls); 145 rc->rc_result = dlm_recover_status(ls);
144 make_config(ls, (struct rcom_config *) rc->rc_buf); 146 make_config(ls, (struct rcom_config *) rc->rc_buf);
145 147
146 send_rcom(ls, mh, rc); 148 send_rcom(ls, mh, rc);
147} 149}
148 150
149static void receive_rcom_status_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) 151static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
150{ 152{
153 if (rc_in->rc_id != ls->ls_rcom_seq) {
154 log_debug(ls, "reject old reply %d got %llx wanted %llx",
155 rc_in->rc_type, rc_in->rc_id, ls->ls_rcom_seq);
156 return;
157 }
151 memcpy(ls->ls_recover_buf, rc_in, rc_in->rc_header.h_length); 158 memcpy(ls->ls_recover_buf, rc_in, rc_in->rc_header.h_length);
152 set_bit(LSFL_RCOM_READY, &ls->ls_flags); 159 set_bit(LSFL_RCOM_READY, &ls->ls_flags);
153 wake_up(&ls->ls_wait_general); 160 wake_up(&ls->ls_wait_general);
154} 161}
155 162
163static void receive_rcom_status_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
164{
165 receive_sync_reply(ls, rc_in);
166}
167
156int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len) 168int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
157{ 169{
158 struct dlm_rcom *rc; 170 struct dlm_rcom *rc;
@@ -173,6 +185,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
173 if (error) 185 if (error)
174 goto out; 186 goto out;
175 memcpy(rc->rc_buf, last_name, last_len); 187 memcpy(rc->rc_buf, last_name, last_len);
188 rc->rc_id = ++ls->ls_rcom_seq;
176 189
177 send_rcom(ls, mh, rc); 190 send_rcom(ls, mh, rc);
178 191
@@ -209,6 +222,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
209 error = create_rcom(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, &rc, &mh); 222 error = create_rcom(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, &rc, &mh);
210 if (error) 223 if (error)
211 return; 224 return;
225 rc->rc_id = rc_in->rc_id;
212 226
213 dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen, 227 dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen,
214 nodeid); 228 nodeid);
@@ -217,9 +231,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
217 231
218static void receive_rcom_names_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) 232static void receive_rcom_names_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
219{ 233{
220 memcpy(ls->ls_recover_buf, rc_in, rc_in->rc_header.h_length); 234 receive_sync_reply(ls, rc_in);
221 set_bit(LSFL_RCOM_READY, &ls->ls_flags);
222 wake_up(&ls->ls_wait_general);
223} 235}
224 236
225int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid) 237int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)