Lines Matching refs: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 void _create_rcom(struct dlm_ls *ls, int to_nodeid, int type, int len, in _create_rcom() argument
38 rc->rc_header.u.h_lockspace = cpu_to_le32(ls->ls_global_id); in _create_rcom()
45 spin_lock(&ls->ls_recover_lock); in _create_rcom()
46 rc->rc_seq = cpu_to_le64(ls->ls_recover_seq); in _create_rcom()
47 spin_unlock(&ls->ls_recover_lock); in _create_rcom()
52 static int create_rcom(struct dlm_ls *ls, int to_nodeid, int type, int len, in create_rcom() argument
66 _create_rcom(ls, to_nodeid, type, len, rc_ret, mb, mb_len); in create_rcom()
71 static int create_rcom_stateless(struct dlm_ls *ls, int to_nodeid, int type, in create_rcom_stateless() argument
87 _create_rcom(ls, to_nodeid, type, len, rc_ret, mb, mb_len); in create_rcom_stateless()
103 static void set_rcom_status(struct dlm_ls *ls, struct rcom_status *rs, in set_rcom_status() argument
113 static void set_rcom_config(struct dlm_ls *ls, struct rcom_config *rf, in set_rcom_config() argument
116 rf->rf_lvblen = cpu_to_le32(ls->ls_lvblen); in set_rcom_config()
117 rf->rf_lsflags = cpu_to_le32(ls->ls_exflags); in set_rcom_config()
119 rf->rf_our_slot = cpu_to_le16(ls->ls_slot); in set_rcom_config()
121 rf->rf_generation = cpu_to_le32(ls->ls_generation); in set_rcom_config()
124 static int check_rcom_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) in check_rcom_config() argument
129 log_error(ls, "version mismatch: %x nodeid %d: %x", in check_rcom_config()
135 if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen || in check_rcom_config()
136 le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) { in check_rcom_config()
137 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x", in check_rcom_config()
138 ls->ls_lvblen, ls->ls_exflags, nodeid, in check_rcom_config()
146 static void allow_sync_reply(struct dlm_ls *ls, __le64 *new_seq) in allow_sync_reply() argument
148 spin_lock(&ls->ls_rcom_spin); in allow_sync_reply()
149 *new_seq = cpu_to_le64(++ls->ls_rcom_seq); in allow_sync_reply()
150 set_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in allow_sync_reply()
151 spin_unlock(&ls->ls_rcom_spin); in allow_sync_reply()
154 static void disallow_sync_reply(struct dlm_ls *ls) in disallow_sync_reply() argument
156 spin_lock(&ls->ls_rcom_spin); in disallow_sync_reply()
157 clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in disallow_sync_reply()
158 clear_bit(LSFL_RCOM_READY, &ls->ls_flags); in disallow_sync_reply()
159 spin_unlock(&ls->ls_rcom_spin); in disallow_sync_reply()
173 int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags) in dlm_rcom_status() argument
179 ls->ls_recover_nodeid = nodeid; in dlm_rcom_status()
182 rc = ls->ls_recover_buf; in dlm_rcom_status()
183 rc->rc_result = cpu_to_le32(dlm_recover_status(ls)); in dlm_rcom_status()
188 error = create_rcom_stateless(ls, nodeid, DLM_RCOM_STATUS, in dlm_rcom_status()
193 set_rcom_status(ls, (struct rcom_status *)rc->rc_buf, status_flags); in dlm_rcom_status()
195 allow_sync_reply(ls, &rc->rc_id); in dlm_rcom_status()
196 memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE); in dlm_rcom_status()
200 error = dlm_wait_function(ls, &rcom_response); in dlm_rcom_status()
201 disallow_sync_reply(ls); in dlm_rcom_status()
207 rc = ls->ls_recover_buf; in dlm_rcom_status()
211 log_debug(ls, "remote node %d not ready", nodeid); in dlm_rcom_status()
215 error = check_rcom_config(ls, rc, nodeid); in dlm_rcom_status()
223 static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_status() argument
235 status = dlm_recover_status(ls); in receive_rcom_status()
242 status = dlm_recover_status(ls); in receive_rcom_status()
246 spin_lock(&ls->ls_recover_lock); in receive_rcom_status()
247 status = ls->ls_recover_status; in receive_rcom_status()
248 num_slots = ls->ls_num_slots; in receive_rcom_status()
249 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
253 error = create_rcom_stateless(ls, nodeid, DLM_RCOM_STATUS_REPLY, in receive_rcom_status()
262 set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, num_slots); in receive_rcom_status()
267 spin_lock(&ls->ls_recover_lock); in receive_rcom_status()
268 if (ls->ls_num_slots != num_slots) { in receive_rcom_status()
269 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
270 log_debug(ls, "receive_rcom_status num_slots %d to %d", in receive_rcom_status()
271 num_slots, ls->ls_num_slots); in receive_rcom_status()
273 set_rcom_config(ls, (struct rcom_config *)rc->rc_buf, 0); in receive_rcom_status()
277 dlm_slots_copy_out(ls, rc); in receive_rcom_status()
278 spin_unlock(&ls->ls_recover_lock); in receive_rcom_status()
284 static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_sync_reply() argument
286 spin_lock(&ls->ls_rcom_spin); in receive_sync_reply()
287 if (!test_bit(LSFL_RCOM_WAIT, &ls->ls_flags) || in receive_sync_reply()
288 le64_to_cpu(rc_in->rc_id) != ls->ls_rcom_seq) { in receive_sync_reply()
289 log_debug(ls, "reject reply %d from %d seq %llx expect %llx", in receive_sync_reply()
293 (unsigned long long)ls->ls_rcom_seq); in receive_sync_reply()
296 memcpy(ls->ls_recover_buf, rc_in, in receive_sync_reply()
298 set_bit(LSFL_RCOM_READY, &ls->ls_flags); in receive_sync_reply()
299 clear_bit(LSFL_RCOM_WAIT, &ls->ls_flags); in receive_sync_reply()
300 wake_up(&ls->ls_wait_general); in receive_sync_reply()
302 spin_unlock(&ls->ls_rcom_spin); in receive_sync_reply()
305 int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len) in dlm_rcom_names() argument
311 ls->ls_recover_nodeid = nodeid; in dlm_rcom_names()
314 error = create_rcom_stateless(ls, nodeid, DLM_RCOM_NAMES, last_len, in dlm_rcom_names()
320 allow_sync_reply(ls, &rc->rc_id); in dlm_rcom_names()
321 memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE); in dlm_rcom_names()
325 error = dlm_wait_function(ls, &rcom_response); in dlm_rcom_names()
326 disallow_sync_reply(ls); in dlm_rcom_names()
333 static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_names() argument
344 error = create_rcom_stateless(ls, nodeid, DLM_RCOM_NAMES_REPLY, outlen, in receive_rcom_names()
351 dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen, in receive_rcom_names()
360 struct dlm_ls *ls = r->res_ls; in dlm_send_rcom_lookup() local
363 error = create_rcom(ls, dir_nodeid, DLM_RCOM_LOOKUP, r->res_length, in dlm_send_rcom_lookup()
375 static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lookup() argument
385 log_error(ls, "receive_rcom_lookup dump from %d", nodeid); in receive_rcom_lookup()
386 dlm_dump_rsb_name(ls, rc_in->rc_buf, len); in receive_rcom_lookup()
390 error = create_rcom(ls, nodeid, DLM_RCOM_LOOKUP_REPLY, 0, &rc, &mh); in receive_rcom_lookup()
394 error = dlm_master_lookup(ls, nodeid, rc_in->rc_buf, len, in receive_rcom_lookup()
405 static void receive_rcom_lookup_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lookup_reply() argument
407 dlm_recover_master_reply(ls, rc_in); in receive_rcom_lookup_reply()
442 struct dlm_ls *ls = r->res_ls; in dlm_send_rcom_lock() local
449 len += ls->ls_lvblen; in dlm_send_rcom_lock()
451 error = create_rcom(ls, r->res_nodeid, DLM_RCOM_LOCK, len, &rc, &mh); in dlm_send_rcom_lock()
465 static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in) in receive_rcom_lock() argument
471 dlm_recover_master_copy(ls, rc_in); in receive_rcom_lock()
473 error = create_rcom(ls, nodeid, DLM_RCOM_LOCK_REPLY, in receive_rcom_lock()
569 void dlm_receive_rcom(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) in dlm_receive_rcom() argument
603 spin_lock(&ls->ls_recover_lock); in dlm_receive_rcom()
604 status = ls->ls_recover_status; in dlm_receive_rcom()
605 stop = dlm_recovery_stopped(ls); in dlm_receive_rcom()
606 seq = ls->ls_recover_seq; in dlm_receive_rcom()
607 spin_unlock(&ls->ls_recover_lock); in dlm_receive_rcom()
623 receive_rcom_status(ls, rc); in dlm_receive_rcom()
627 receive_rcom_names(ls, rc); in dlm_receive_rcom()
631 receive_rcom_lookup(ls, rc); in dlm_receive_rcom()
637 receive_rcom_lock(ls, rc); in dlm_receive_rcom()
641 receive_sync_reply(ls, rc); in dlm_receive_rcom()
645 receive_sync_reply(ls, rc); in dlm_receive_rcom()
649 receive_rcom_lookup_reply(ls, rc); in dlm_receive_rcom()
655 dlm_recover_process_copy(ls, rc); in dlm_receive_rcom()
659 log_error(ls, "receive_rcom bad type %d", in dlm_receive_rcom()
665 log_limit(ls, "dlm_receive_rcom ignore msg %d " in dlm_receive_rcom()
672 status, ls->ls_generation); in dlm_receive_rcom()
675 log_error(ls, "recovery message %d from %d is too short", in dlm_receive_rcom()