rcom.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /******************************************************************************
  2. *******************************************************************************
  3. **
  4. ** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
  5. ** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
  6. **
  7. ** This copyrighted material is made available to anyone wishing to use,
  8. ** modify, copy, or redistribute it subject to the terms and conditions
  9. ** of the GNU General Public License v.2.
  10. **
  11. *******************************************************************************
  12. ******************************************************************************/
  13. #include "dlm_internal.h"
  14. #include "lockspace.h"
  15. #include "member.h"
  16. #include "lowcomms.h"
  17. #include "midcomms.h"
  18. #include "rcom.h"
  19. #include "recover.h"
  20. #include "dir.h"
  21. #include "config.h"
  22. #include "memory.h"
  23. #include "lock.h"
  24. #include "util.h"
  25. static int rcom_response(struct dlm_ls *ls)
  26. {
  27. return test_bit(LSFL_RCOM_READY, &ls->ls_flags);
  28. }
  29. static int create_rcom(struct dlm_ls *ls, int to_nodeid, int type, int len,
  30. struct dlm_rcom **rc_ret, struct dlm_mhandle **mh_ret)
  31. {
  32. struct dlm_rcom *rc;
  33. struct dlm_mhandle *mh;
  34. char *mb;
  35. int mb_len = sizeof(struct dlm_rcom) + len;
  36. mh = dlm_lowcomms_get_buffer(to_nodeid, mb_len, GFP_NOFS, &mb);
  37. if (!mh) {
  38. log_print("create_rcom to %d type %d len %d ENOBUFS",
  39. to_nodeid, type, len);
  40. return -ENOBUFS;
  41. }
  42. memset(mb, 0, mb_len);
  43. rc = (struct dlm_rcom *) mb;
  44. rc->rc_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR);
  45. rc->rc_header.h_lockspace = ls->ls_global_id;
  46. rc->rc_header.h_nodeid = dlm_our_nodeid();
  47. rc->rc_header.h_length = mb_len;
  48. rc->rc_header.h_cmd = DLM_RCOM;
  49. rc->rc_type = type;
  50. spin_lock(&ls->ls_recover_lock);
  51. rc->rc_seq = ls->ls_recover_seq;
  52. spin_unlock(&ls->ls_recover_lock);
  53. *mh_ret = mh;
  54. *rc_ret = rc;
  55. return 0;
  56. }
  57. static void send_rcom(struct dlm_ls *ls, struct dlm_mhandle *mh,
  58. struct dlm_rcom *rc)
  59. {
  60. dlm_rcom_out(rc);
  61. dlm_lowcomms_commit_buffer(mh);
  62. }
  63. static void set_rcom_status(struct dlm_ls *ls, struct rcom_status *rs,
  64. uint32_t flags)
  65. {
  66. rs->rs_flags = cpu_to_le32(flags);
  67. }
  68. /* When replying to a status request, a node also sends back its
  69. configuration values. The requesting node then checks that the remote
  70. node is configured the same way as itself. */
  71. static void set_rcom_config(struct dlm_ls *ls, struct rcom_config *rf,
  72. uint32_t num_slots)
  73. {
  74. rf->rf_lvblen = cpu_to_le32(ls->ls_lvblen);
  75. rf->rf_lsflags = cpu_to_le32(ls->ls_exflags);
  76. rf->rf_our_slot = cpu_to_le16(ls->ls_slot);
  77. rf->rf_num_slots = cpu_to_le16(num_slots);
  78. rf->rf_generation = cpu_to_le32(ls->ls_generation);
  79. }
  80. static int check_rcom_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
  81. {
  82. struct rcom_config *rf = (struct rcom_config *) rc->rc_buf;
  83. if ((rc->rc_header.h_version & 0xFFFF0000) != DLM_HEADER_MAJOR) {
  84. log_error(ls, "version mismatch: %x nodeid %d: %x",
  85. DLM_HEADER_MAJOR | DLM_HEADER_MINOR, nodeid,
  86. rc->rc_header.h_version);
  87. return -EPROTO;
  88. }
  89. if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen ||
  90. le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) {
  91. log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",
  92. ls->ls_lvblen, ls->ls_exflags, nodeid,
  93. le32_to_cpu(rf->rf_lvblen),
  94. le32_to_cpu(rf->rf_lsflags));
  95. return -EPROTO;
  96. }
  97. return 0;
  98. }
  99. static void allow_sync_reply(struct dlm_ls *ls, uint64_t *new_seq)
  100. {
  101. spin_lock(&ls->ls_rcom_spin);
  102. *new_seq = ++ls->ls_rcom_seq;
  103. set_bit(LSFL_RCOM_WAIT, &ls->ls_flags);
  104. spin_unlock(&ls->ls_rcom_spin);
  105. }
  106. static void disallow_sync_reply(struct dlm_ls *ls)
  107. {
  108. spin_lock(&ls->ls_rcom_spin);
  109. clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags);
  110. clear_bit(LSFL_RCOM_READY, &ls->ls_flags);
  111. spin_unlock(&ls->ls_rcom_spin);
  112. }
  113. /*
  114. * low nodeid gathers one slot value at a time from each node.
  115. * it sets need_slots=0, and saves rf_our_slot returned from each
  116. * rcom_config.
  117. *
  118. * other nodes gather all slot values at once from the low nodeid.
  119. * they set need_slots=1, and ignore the rf_our_slot returned from each
  120. * rcom_config. they use the rf_num_slots returned from the low
  121. * node's rcom_config.
  122. */
  123. int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags)
  124. {
  125. struct dlm_rcom *rc;
  126. struct dlm_mhandle *mh;
  127. int error = 0;
  128. ls->ls_recover_nodeid = nodeid;
  129. if (nodeid == dlm_our_nodeid()) {
  130. rc = ls->ls_recover_buf;
  131. rc->rc_result = dlm_recover_status(ls);
  132. goto out;
  133. }
  134. retry:
  135. error = create_rcom(ls, nodeid, DLM_RCOM_STATUS,
  136. sizeof(struct rcom_status), &rc, &mh);
  137. if (error)
  138. goto out;
  139. set_rcom_status(ls, (struct rcom_status *)rc->rc_buf, status_flags);
  140. allow_sync_reply(ls, &rc->rc_id);
  141. memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size);
  142. send_rcom(ls, mh, rc);
  143. error = dlm_wait_function(ls, &rcom_response);
  144. disallow_sync_reply(ls);
  145. if (error == -ETIMEDOUT)
  146. goto retry;
  147. if (error)
  148. goto out;
  149. rc = ls->ls_recover_buf;
  150. if (rc->rc_result == -ESRCH) {
  151. /* we pretend the remote lockspace exists with 0 status */
  152. log_debug(ls, "remote node %d not ready", nodeid);
  153. rc->rc_result = 0;
  154. error = 0;
  155. } else {
  156. error = check_rcom_config(ls, rc, nodeid);
  157. }
  158. /* the caller looks at rc_result for the remote recovery status */
  159. out:
  160. return error;
  161. }
  162. static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  163. {
  164. struct dlm_rcom *rc;
  165. struct dlm_mhandle *mh;
  166. struct rcom_status *rs;
  167. uint32_t status;
  168. int nodeid = rc_in->rc_header.h_nodeid;
  169. int len = sizeof(struct rcom_config);
  170. int num_slots = 0;
  171. int error;
  172. if (!dlm_slots_version(&rc_in->rc_header)) {
  173. status = dlm_recover_status(ls);
  174. goto do_create;
  175. }
  176. rs = (struct rcom_status *)rc_in->rc_buf;
  177. if (!(le32_to_cpu(rs->rs_flags) & DLM_RSF_NEED_SLOTS)) {
  178. status = dlm_recover_status(ls);
  179. goto do_create;
  180. }
  181. spin_lock(&ls->ls_recover_lock);
  182. status = ls->ls_recover_status;
  183. num_slots = ls->ls_num_slots;
  184. spin_unlock(&ls->ls_recover_lock);
  185. len += num_slots * sizeof(struct rcom_slot);
  186. do_create:
  187. error = create_rcom(ls, nodeid, DLM_RCOM_STATUS_REPLY,
  188. len, &rc, &mh);
  189. if (error)
  190. return;
  191. rc->rc_id = rc_in->rc_id;
  192. rc->rc_seq_reply = rc_in->rc_seq;
  193. rc->rc_result = status;
  194. set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, num_slots);
  195. if (!num_slots)
  196. goto do_send;
  197. spin_lock(&ls->ls_recover_lock);
  198. if (ls->ls_num_slots != num_slots) {
  199. spin_unlock(&ls->ls_recover_lock);
  200. log_debug(ls, "receive_rcom_status num_slots %d to %d",
  201. num_slots, ls->ls_num_slots);
  202. rc->rc_result = 0;
  203. set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, 0);
  204. goto do_send;
  205. }
  206. dlm_slots_copy_out(ls, rc);
  207. spin_unlock(&ls->ls_recover_lock);
  208. do_send:
  209. send_rcom(ls, mh, rc);
  210. }
  211. static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  212. {
  213. spin_lock(&ls->ls_rcom_spin);
  214. if (!test_bit(LSFL_RCOM_WAIT, &ls->ls_flags) ||
  215. rc_in->rc_id != ls->ls_rcom_seq) {
  216. log_debug(ls, "reject reply %d from %d seq %llx expect %llx",
  217. rc_in->rc_type, rc_in->rc_header.h_nodeid,
  218. (unsigned long long)rc_in->rc_id,
  219. (unsigned long long)ls->ls_rcom_seq);
  220. goto out;
  221. }
  222. memcpy(ls->ls_recover_buf, rc_in, rc_in->rc_header.h_length);
  223. set_bit(LSFL_RCOM_READY, &ls->ls_flags);
  224. clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags);
  225. wake_up(&ls->ls_wait_general);
  226. out:
  227. spin_unlock(&ls->ls_rcom_spin);
  228. }
  229. int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
  230. {
  231. struct dlm_rcom *rc;
  232. struct dlm_mhandle *mh;
  233. int error = 0;
  234. ls->ls_recover_nodeid = nodeid;
  235. retry:
  236. error = create_rcom(ls, nodeid, DLM_RCOM_NAMES, last_len, &rc, &mh);
  237. if (error)
  238. goto out;
  239. memcpy(rc->rc_buf, last_name, last_len);
  240. allow_sync_reply(ls, &rc->rc_id);
  241. memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size);
  242. send_rcom(ls, mh, rc);
  243. error = dlm_wait_function(ls, &rcom_response);
  244. disallow_sync_reply(ls);
  245. if (error == -ETIMEDOUT)
  246. goto retry;
  247. out:
  248. return error;
  249. }
  250. static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  251. {
  252. struct dlm_rcom *rc;
  253. struct dlm_mhandle *mh;
  254. int error, inlen, outlen, nodeid;
  255. nodeid = rc_in->rc_header.h_nodeid;
  256. inlen = rc_in->rc_header.h_length - sizeof(struct dlm_rcom);
  257. outlen = dlm_config.ci_buffer_size - sizeof(struct dlm_rcom);
  258. error = create_rcom(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, &rc, &mh);
  259. if (error)
  260. return;
  261. rc->rc_id = rc_in->rc_id;
  262. rc->rc_seq_reply = rc_in->rc_seq;
  263. dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen,
  264. nodeid);
  265. send_rcom(ls, mh, rc);
  266. }
  267. int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)
  268. {
  269. struct dlm_rcom *rc;
  270. struct dlm_mhandle *mh;
  271. struct dlm_ls *ls = r->res_ls;
  272. int error;
  273. error = create_rcom(ls, dir_nodeid, DLM_RCOM_LOOKUP, r->res_length,
  274. &rc, &mh);
  275. if (error)
  276. goto out;
  277. memcpy(rc->rc_buf, r->res_name, r->res_length);
  278. rc->rc_id = (unsigned long) r->res_id;
  279. send_rcom(ls, mh, rc);
  280. out:
  281. return error;
  282. }
  283. static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  284. {
  285. struct dlm_rcom *rc;
  286. struct dlm_mhandle *mh;
  287. int error, ret_nodeid, nodeid = rc_in->rc_header.h_nodeid;
  288. int len = rc_in->rc_header.h_length - sizeof(struct dlm_rcom);
  289. error = create_rcom(ls, nodeid, DLM_RCOM_LOOKUP_REPLY, 0, &rc, &mh);
  290. if (error)
  291. return;
  292. /* Old code would send this special id to trigger a debug dump. */
  293. if (rc_in->rc_id == 0xFFFFFFFF) {
  294. log_error(ls, "receive_rcom_lookup dump from %d", nodeid);
  295. dlm_dump_rsb_name(ls, rc_in->rc_buf, len);
  296. return;
  297. }
  298. error = dlm_master_lookup(ls, nodeid, rc_in->rc_buf, len,
  299. DLM_LU_RECOVER_MASTER, &ret_nodeid, NULL);
  300. if (error)
  301. ret_nodeid = error;
  302. rc->rc_result = ret_nodeid;
  303. rc->rc_id = rc_in->rc_id;
  304. rc->rc_seq_reply = rc_in->rc_seq;
  305. send_rcom(ls, mh, rc);
  306. }
  307. static void receive_rcom_lookup_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  308. {
  309. dlm_recover_master_reply(ls, rc_in);
  310. }
  311. static void pack_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb,
  312. struct rcom_lock *rl)
  313. {
  314. memset(rl, 0, sizeof(*rl));
  315. rl->rl_ownpid = cpu_to_le32(lkb->lkb_ownpid);
  316. rl->rl_lkid = cpu_to_le32(lkb->lkb_id);
  317. rl->rl_exflags = cpu_to_le32(lkb->lkb_exflags);
  318. rl->rl_flags = cpu_to_le32(lkb->lkb_flags);
  319. rl->rl_lvbseq = cpu_to_le32(lkb->lkb_lvbseq);
  320. rl->rl_rqmode = lkb->lkb_rqmode;
  321. rl->rl_grmode = lkb->lkb_grmode;
  322. rl->rl_status = lkb->lkb_status;
  323. rl->rl_wait_type = cpu_to_le16(lkb->lkb_wait_type);
  324. if (lkb->lkb_bastfn)
  325. rl->rl_asts |= DLM_CB_BAST;
  326. if (lkb->lkb_astfn)
  327. rl->rl_asts |= DLM_CB_CAST;
  328. rl->rl_namelen = cpu_to_le16(r->res_length);
  329. memcpy(rl->rl_name, r->res_name, r->res_length);
  330. /* FIXME: might we have an lvb without DLM_LKF_VALBLK set ?
  331. If so, receive_rcom_lock_args() won't take this copy. */
  332. if (lkb->lkb_lvbptr)
  333. memcpy(rl->rl_lvb, lkb->lkb_lvbptr, r->res_ls->ls_lvblen);
  334. }
  335. int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
  336. {
  337. struct dlm_ls *ls = r->res_ls;
  338. struct dlm_rcom *rc;
  339. struct dlm_mhandle *mh;
  340. struct rcom_lock *rl;
  341. int error, len = sizeof(struct rcom_lock);
  342. if (lkb->lkb_lvbptr)
  343. len += ls->ls_lvblen;
  344. error = create_rcom(ls, r->res_nodeid, DLM_RCOM_LOCK, len, &rc, &mh);
  345. if (error)
  346. goto out;
  347. rl = (struct rcom_lock *) rc->rc_buf;
  348. pack_rcom_lock(r, lkb, rl);
  349. rc->rc_id = (unsigned long) r;
  350. send_rcom(ls, mh, rc);
  351. out:
  352. return error;
  353. }
  354. /* needs at least dlm_rcom + rcom_lock */
  355. static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in)
  356. {
  357. struct dlm_rcom *rc;
  358. struct dlm_mhandle *mh;
  359. int error, nodeid = rc_in->rc_header.h_nodeid;
  360. dlm_recover_master_copy(ls, rc_in);
  361. error = create_rcom(ls, nodeid, DLM_RCOM_LOCK_REPLY,
  362. sizeof(struct rcom_lock), &rc, &mh);
  363. if (error)
  364. return;
  365. /* We send back the same rcom_lock struct we received, but
  366. dlm_recover_master_copy() has filled in rl_remid and rl_result */
  367. memcpy(rc->rc_buf, rc_in->rc_buf, sizeof(struct rcom_lock));
  368. rc->rc_id = rc_in->rc_id;
  369. rc->rc_seq_reply = rc_in->rc_seq;
  370. send_rcom(ls, mh, rc);
  371. }
  372. /* If the lockspace doesn't exist then still send a status message
  373. back; it's possible that it just doesn't have its global_id yet. */
  374. int dlm_send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
  375. {
  376. struct dlm_rcom *rc;
  377. struct rcom_config *rf;
  378. struct dlm_mhandle *mh;
  379. char *mb;
  380. int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config);
  381. mh = dlm_lowcomms_get_buffer(nodeid, mb_len, GFP_NOFS, &mb);
  382. if (!mh)
  383. return -ENOBUFS;
  384. memset(mb, 0, mb_len);
  385. rc = (struct dlm_rcom *) mb;
  386. rc->rc_header.h_version = (DLM_HEADER_MAJOR | DLM_HEADER_MINOR);
  387. rc->rc_header.h_lockspace = rc_in->rc_header.h_lockspace;
  388. rc->rc_header.h_nodeid = dlm_our_nodeid();
  389. rc->rc_header.h_length = mb_len;
  390. rc->rc_header.h_cmd = DLM_RCOM;
  391. rc->rc_type = DLM_RCOM_STATUS_REPLY;
  392. rc->rc_id = rc_in->rc_id;
  393. rc->rc_seq_reply = rc_in->rc_seq;
  394. rc->rc_result = -ESRCH;
  395. rf = (struct rcom_config *) rc->rc_buf;
  396. rf->rf_lvblen = cpu_to_le32(~0U);
  397. dlm_rcom_out(rc);
  398. dlm_lowcomms_commit_buffer(mh);
  399. return 0;
  400. }
  401. /*
  402. * Ignore messages for stage Y before we set
  403. * recover_status bit for stage X:
  404. *
  405. * recover_status = 0
  406. *
  407. * dlm_recover_members()
  408. * - send nothing
  409. * - recv nothing
  410. * - ignore NAMES, NAMES_REPLY
  411. * - ignore LOOKUP, LOOKUP_REPLY
  412. * - ignore LOCK, LOCK_REPLY
  413. *
  414. * recover_status |= NODES
  415. *
  416. * dlm_recover_members_wait()
  417. *
  418. * dlm_recover_directory()
  419. * - send NAMES
  420. * - recv NAMES_REPLY
  421. * - ignore LOOKUP, LOOKUP_REPLY
  422. * - ignore LOCK, LOCK_REPLY
  423. *
  424. * recover_status |= DIR
  425. *
  426. * dlm_recover_directory_wait()
  427. *
  428. * dlm_recover_masters()
  429. * - send LOOKUP
  430. * - recv LOOKUP_REPLY
  431. *
  432. * dlm_recover_locks()
  433. * - send LOCKS
  434. * - recv LOCKS_REPLY
  435. *
  436. * recover_status |= LOCKS
  437. *
  438. * dlm_recover_locks_wait()
  439. *
  440. * recover_status |= DONE
  441. */
  442. /* Called by dlm_recv; corresponds to dlm_receive_message() but special
  443. recovery-only comms are sent through here. */
  444. void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
  445. {
  446. int lock_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_lock);
  447. int stop, reply = 0, names = 0, lookup = 0, lock = 0;
  448. uint32_t status;
  449. uint64_t seq;
  450. switch (rc->rc_type) {
  451. case DLM_RCOM_STATUS_REPLY:
  452. reply = 1;
  453. break;
  454. case DLM_RCOM_NAMES:
  455. names = 1;
  456. break;
  457. case DLM_RCOM_NAMES_REPLY:
  458. names = 1;
  459. reply = 1;
  460. break;
  461. case DLM_RCOM_LOOKUP:
  462. lookup = 1;
  463. break;
  464. case DLM_RCOM_LOOKUP_REPLY:
  465. lookup = 1;
  466. reply = 1;
  467. break;
  468. case DLM_RCOM_LOCK:
  469. lock = 1;
  470. break;
  471. case DLM_RCOM_LOCK_REPLY:
  472. lock = 1;
  473. reply = 1;
  474. break;
  475. };
  476. spin_lock(&ls->ls_recover_lock);
  477. status = ls->ls_recover_status;
  478. stop = test_bit(LSFL_RECOVER_STOP, &ls->ls_flags);
  479. seq = ls->ls_recover_seq;
  480. spin_unlock(&ls->ls_recover_lock);
  481. if (stop && (rc->rc_type != DLM_RCOM_STATUS))
  482. goto ignore;
  483. if (reply && (rc->rc_seq_reply != seq))
  484. goto ignore;
  485. if (!(status & DLM_RS_NODES) && (names || lookup || lock))
  486. goto ignore;
  487. if (!(status & DLM_RS_DIR) && (lookup || lock))
  488. goto ignore;
  489. switch (rc->rc_type) {
  490. case DLM_RCOM_STATUS:
  491. receive_rcom_status(ls, rc);
  492. break;
  493. case DLM_RCOM_NAMES:
  494. receive_rcom_names(ls, rc);
  495. break;
  496. case DLM_RCOM_LOOKUP:
  497. receive_rcom_lookup(ls, rc);
  498. break;
  499. case DLM_RCOM_LOCK:
  500. if (rc->rc_header.h_length < lock_size)
  501. goto Eshort;
  502. receive_rcom_lock(ls, rc);
  503. break;
  504. case DLM_RCOM_STATUS_REPLY:
  505. receive_sync_reply(ls, rc);
  506. break;
  507. case DLM_RCOM_NAMES_REPLY:
  508. receive_sync_reply(ls, rc);
  509. break;
  510. case DLM_RCOM_LOOKUP_REPLY:
  511. receive_rcom_lookup_reply(ls, rc);
  512. break;
  513. case DLM_RCOM_LOCK_REPLY:
  514. if (rc->rc_header.h_length < lock_size)
  515. goto Eshort;
  516. dlm_recover_process_copy(ls, rc);
  517. break;
  518. default:
  519. log_error(ls, "receive_rcom bad type %d", rc->rc_type);
  520. }
  521. return;
  522. ignore:
  523. log_limit(ls, "dlm_receive_rcom ignore msg %d "
  524. "from %d %llu %llu recover seq %llu sts %x gen %u",
  525. rc->rc_type,
  526. nodeid,
  527. (unsigned long long)rc->rc_seq,
  528. (unsigned long long)rc->rc_seq_reply,
  529. (unsigned long long)seq,
  530. status, ls->ls_generation);
  531. return;
  532. Eshort:
  533. log_error(ls, "recovery message %d from %d is too short",
  534. rc->rc_type, nodeid);
  535. }