Lines Matching full:ls
25 static int rcom_response(struct dlm_ls *ls) in rcom_response() argument
27 return test_bit(LSFL_RCOM_READY, &ls->ls_flags); in rcom_response()
30 static int create_rcom(struct dlm_ls *ls, int to_nodeid, int type, int len, in create_rcom() argument
49 rc->rc_header.h_lockspace = ls->ls_global_id; in create_rcom()
56 spin_lock(&ls->ls_recover_lock); in create_rcom()
57 rc->rc_seq = ls->ls_recover_seq; in create_rcom()
58 spin_unlock(&ls->ls_recover_lock); in create_rcom()
65 static void send_rcom(struct dlm_ls *ls, struct dlm_mhandle *mh, in send_rcom() argument
72 static void set_rcom_status(struct dlm_ls *ls, struct rcom_status *rs, in set_rcom_status() argument
82 static void set_rcom_config(struct dlm_ls *ls, struct rcom_config *rf, in set_rcom_config() argument
85 rf->rf_lvblen = cpu_to_le32(ls->ls_lvblen); in set_rcom_config()
86 rf->rf_lsflags = cpu_to_le32(ls->ls_exflags); in set_rcom_config()
88 rf->rf_our_slot = cpu_to_le16(ls->ls_slot); in set_rcom_config()
90 rf->rf_generation = cpu_to_le32(ls->ls_generation); in set_rcom_config()
93 static int check_rcom_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) in check_rcom_config() argument
98 log_error(ls, "version mismatch: %x nodeid %d: %x", in check_rcom_config()
104 if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen || in check_rcom_config()
105 le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) { in check_rcom_config()
106 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x", in check_rcom_config()
107 ls->ls_lvblen, ls->ls_exflags, nodeid, in check_rcom_config()
115 static void allow_sync_reply(struct dlm_ls *ls, uint64_t *new_seq) in allow_sync_reply() argument
117 spin_lock(&ls->ls_rcom_spin); in allow_sync_reply()
118 *new_seq = ++ls->ls_rcom_seq; in allow_sync_reply()
119 set_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in allow_sync_reply()
120 spin_unlock(&ls->ls_rcom_spin); in allow_sync_reply()
123 static void disallow_sync_reply(struct dlm_ls *ls) in disallow_sync_reply() argument
125 spin_lock(&ls->ls_rcom_spin); in disallow_sync_reply()
126 clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in disallow_sync_reply()
127 clear_bit(LSFL_RCOM_READY, &ls->ls_flags); in disallow_sync_reply()
128 spin_unlock(&ls->ls_rcom_spin); in disallow_sync_reply()
142 int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags) in dlm_rcom_status() argument
148 ls->ls_recover_nodeid = nodeid; in dlm_rcom_status()
151 rc = ls->ls_recover_buf; in dlm_rcom_status()
152 rc->rc_result = dlm_recover_status(ls); in dlm_rcom_status()
157 error = create_rcom(ls, nodeid, DLM_RCOM_STATUS, in dlm_rcom_status()
162 set_rcom_status(ls, (struct rcom_status *)rc->rc_buf, status_flags); in dlm_rcom_status()
164 allow_sync_reply(ls, &rc->rc_id); in dlm_rcom_status()
165 memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size); in dlm_rcom_status()
167 send_rcom(ls, mh, rc); in dlm_rcom_status()
169 error = dlm_wait_function(ls, &rcom_response); in dlm_rcom_status()
170 disallow_sync_reply(ls); in dlm_rcom_status()
176 rc = ls->ls_recover_buf; in dlm_rcom_status()
180 log_debug(ls, "remote node %d not ready", nodeid); in dlm_rcom_status()
184 error = check_rcom_config(ls, rc, nodeid); in dlm_rcom_status()
192 static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_status() argument
204 status = dlm_recover_status(ls); in receive_rcom_status()
211 status = dlm_recover_status(ls); in receive_rcom_status()
215 spin_lock(&ls->ls_recover_lock); in receive_rcom_status()
216 status = ls->ls_recover_status; in receive_rcom_status()
217 num_slots = ls->ls_num_slots; in receive_rcom_status()
218 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
222 error = create_rcom(ls, nodeid, DLM_RCOM_STATUS_REPLY, in receive_rcom_status()
231 set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, num_slots); in receive_rcom_status()
236 spin_lock(&ls->ls_recover_lock); in receive_rcom_status()
237 if (ls->ls_num_slots != num_slots) { in receive_rcom_status()
238 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
239 log_debug(ls, "receive_rcom_status num_slots %d to %d", in receive_rcom_status()
240 num_slots, ls->ls_num_slots); in receive_rcom_status()
242 set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, 0); in receive_rcom_status()
246 dlm_slots_copy_out(ls, rc); in receive_rcom_status()
247 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
250 send_rcom(ls, mh, rc); in receive_rcom_status()
253 static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_sync_reply() argument
255 spin_lock(&ls->ls_rcom_spin); in receive_sync_reply()
256 if (!test_bit(LSFL_RCOM_WAIT, &ls->ls_flags) || in receive_sync_reply()
257 rc_in->rc_id != ls->ls_rcom_seq) { in receive_sync_reply()
258 log_debug(ls, "reject reply %d from %d seq %llx expect %llx", in receive_sync_reply()
261 (unsigned long long)ls->ls_rcom_seq); in receive_sync_reply()
264 memcpy(ls->ls_recover_buf, rc_in, rc_in->rc_header.h_length); in receive_sync_reply()
265 set_bit(LSFL_RCOM_READY, &ls->ls_flags); in receive_sync_reply()
266 clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in receive_sync_reply()
267 wake_up(&ls->ls_wait_general); in receive_sync_reply()
269 spin_unlock(&ls->ls_rcom_spin); in receive_sync_reply()
272 int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len) in dlm_rcom_names() argument
278 ls->ls_recover_nodeid = nodeid; in dlm_rcom_names()
281 error = create_rcom(ls, nodeid, DLM_RCOM_NAMES, last_len, &rc, &mh); in dlm_rcom_names()
286 allow_sync_reply(ls, &rc->rc_id); in dlm_rcom_names()
287 memset(ls->ls_recover_buf, 0, dlm_config.ci_buffer_size); in dlm_rcom_names()
289 send_rcom(ls, mh, rc); in dlm_rcom_names()
291 error = dlm_wait_function(ls, &rcom_response); in dlm_rcom_names()
292 disallow_sync_reply(ls); in dlm_rcom_names()
299 static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_names() argument
309 error = create_rcom(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, &rc, &mh); in receive_rcom_names()
315 dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen, in receive_rcom_names()
317 send_rcom(ls, mh, rc); in receive_rcom_names()
324 struct dlm_ls *ls = r->res_ls; in dlm_send_rcom_lookup() local
327 error = create_rcom(ls, dir_nodeid, DLM_RCOM_LOOKUP, r->res_length, in dlm_send_rcom_lookup()
334 send_rcom(ls, mh, rc); in dlm_send_rcom_lookup()
339 static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lookup() argument
346 error = create_rcom(ls, nodeid, DLM_RCOM_LOOKUP_REPLY, 0, &rc, &mh); in receive_rcom_lookup()
352 log_error(ls, "receive_rcom_lookup dump from %d", nodeid); in receive_rcom_lookup()
353 dlm_dump_rsb_name(ls, rc_in->rc_buf, len); in receive_rcom_lookup()
357 error = dlm_master_lookup(ls, nodeid, rc_in->rc_buf, len, in receive_rcom_lookup()
365 send_rcom(ls, mh, rc); in receive_rcom_lookup()
368 static void receive_rcom_lookup_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lookup_reply() argument
370 dlm_recover_master_reply(ls, rc_in); in receive_rcom_lookup_reply()
405 struct dlm_ls *ls = r->res_ls; in dlm_send_rcom_lock() local
412 len += ls->ls_lvblen; in dlm_send_rcom_lock()
414 error = create_rcom(ls, r->res_nodeid, DLM_RCOM_LOCK, len, &rc, &mh); in dlm_send_rcom_lock()
422 send_rcom(ls, mh, rc); in dlm_send_rcom_lock()
428 static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lock() argument
434 dlm_recover_master_copy(ls, rc_in); in receive_rcom_lock()
436 error = create_rcom(ls, nodeid, DLM_RCOM_LOCK_REPLY, in receive_rcom_lock()
448 send_rcom(ls, mh, rc); in receive_rcom_lock()
534 void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) in dlm_receive_rcom() argument
568 spin_lock(&ls->ls_recover_lock); in dlm_receive_rcom()
569 status = ls->ls_recover_status; in dlm_receive_rcom()
570 stop = test_bit(LSFL_RECOVER_STOP, &ls->ls_flags); in dlm_receive_rcom()
571 seq = ls->ls_recover_seq; in dlm_receive_rcom()
572 spin_unlock(&ls->ls_recover_lock); in dlm_receive_rcom()
588 receive_rcom_status(ls, rc); in dlm_receive_rcom()
592 receive_rcom_names(ls, rc); in dlm_receive_rcom()
596 receive_rcom_lookup(ls, rc); in dlm_receive_rcom()
602 receive_rcom_lock(ls, rc); in dlm_receive_rcom()
606 receive_sync_reply(ls, rc); in dlm_receive_rcom()
610 receive_sync_reply(ls, rc); in dlm_receive_rcom()
614 receive_rcom_lookup_reply(ls, rc); in dlm_receive_rcom()
620 dlm_recover_process_copy(ls, rc); in dlm_receive_rcom()
624 log_error(ls, "receive_rcom bad type %d", rc->rc_type); in dlm_receive_rcom()
629 log_limit(ls, "dlm_receive_rcom ignore msg %d " in dlm_receive_rcom()
636 status, ls->ls_generation); in dlm_receive_rcom()
639 log_error(ls, "recovery message %d from %d is too short", in dlm_receive_rcom()