27 static int rcom_response(
struct dlm_ls *ls)
32 static int create_rcom(
struct dlm_ls *ls,
int to_nodeid,
int type,
int len,
33 struct dlm_rcom **rc_ret,
struct dlm_mhandle **mh_ret)
36 struct dlm_mhandle *mh;
38 int mb_len =
sizeof(
struct dlm_rcom) + len;
42 log_print(
"create_rcom to %d type %d len %d ENOBUFS",
43 to_nodeid, type, len);
67 static void send_rcom(
struct dlm_ls *ls,
struct dlm_mhandle *mh,
95 static int check_rcom_config(
struct dlm_ls *ls,
struct dlm_rcom *rc,
int nodeid)
100 log_error(ls,
"version mismatch: %x nodeid %d: %x",
108 log_error(ls,
"config mismatch: %d,%x nodeid %d: %d,%x",
117 static void allow_sync_reply(
struct dlm_ls *ls,
uint64_t *new_seq)
125 static void disallow_sync_reply(
struct dlm_ls *ls)
147 struct dlm_mhandle *mh;
165 allow_sync_reply(ls, &rc->
rc_id);
168 send_rcom(ls, mh, rc);
171 disallow_sync_reply(ls);
179 log_debug(ls,
"remote node %d not ready", nodeid);
183 error = check_rcom_config(ls, rc, nodeid);
191 static void receive_rcom_status(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
194 struct dlm_mhandle *mh;
218 len += num_slots *
sizeof(
struct rcom_slot);
238 log_debug(ls,
"receive_rcom_status num_slots %d to %d",
249 send_rcom(ls, mh, rc);
252 static void receive_sync_reply(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
257 log_debug(ls,
"reject reply %d from %d seq %llx expect %llx",
259 (
unsigned long long)rc_in->
rc_id,
274 struct dlm_mhandle *mh;
279 error = create_rcom(ls, nodeid,
DLM_RCOM_NAMES, last_len, &rc, &mh);
284 allow_sync_reply(ls, &rc->
rc_id);
287 send_rcom(ls, mh, rc);
290 disallow_sync_reply(ls);
295 static void receive_rcom_names(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
298 struct dlm_mhandle *mh;
313 send_rcom(ls, mh, rc);
319 struct dlm_mhandle *mh;
330 send_rcom(ls, mh, rc);
338 struct dlm_mhandle *mh;
347 rc->
rc_id = 0xFFFFFFFF;
349 send_rcom(ls, mh, rc);
354 static void receive_rcom_lookup(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
357 struct dlm_mhandle *mh;
365 if (rc_in->
rc_id == 0xFFFFFFFF) {
366 log_error(ls,
"receive_rcom_lookup dump from %d", nodeid);
379 send_rcom(ls, mh, rc);
382 static void receive_rcom_lookup_reply(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
390 memset(rl, 0,
sizeof(*rl));
421 struct dlm_mhandle *mh;
433 pack_rcom_lock(r, lkb, rl);
436 send_rcom(ls, mh, rc);
442 static void receive_rcom_lock(
struct dlm_ls *ls,
struct dlm_rcom *rc_in)
445 struct dlm_mhandle *mh;
462 send_rcom(ls, mh, rc);
472 struct dlm_mhandle *mh;
474 int mb_len =
sizeof(
struct dlm_rcom) + sizeof(struct rcom_config);
494 rf = (
struct rcom_config *) rc->
rc_buf;
550 int lock_size =
sizeof(
struct dlm_rcom) + sizeof(struct rcom_lock);
602 receive_rcom_status(ls, rc);
606 receive_rcom_names(ls, rc);
610 receive_rcom_lookup(ls, rc);
616 receive_rcom_lock(ls, rc);
620 receive_sync_reply(ls, rc);
624 receive_sync_reply(ls, rc);
628 receive_rcom_lookup_reply(ls, rc);
643 log_limit(ls,
"dlm_receive_rcom ignore msg %d "
644 "from %d %llu %llu recover seq %llu sts %x gen %u",
647 (
unsigned long long)rc->
rc_seq,
649 (
unsigned long long)seq,
653 log_error(ls,
"recovery message %d from %d is too short",