38 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_HA 96 const char *remote_rpc_endpoint,
98 const char *git_rev_id,
202 const char *build_git_rev_id,
203 const char *build_configure_opts,
204 bool disable_compat_check)
208 M0_ENTRY(
"build_git_rev_id=%s build_configure_opts=%s " 209 "disable_compat_check=%d", build_git_rev_id,
210 build_configure_opts, !!disable_compat_check);
211 if (disable_compat_check)
221 "motr library (%s) do not match the expected ones (%s)",
230 const char *debug_options)
234 M0_ENTRY(
"hi=%p debug_options=%s",
hi, debug_options);
236 if (debug_options ==
NULL)
293 "Currently we don't support " 294 "more than %zu processes " 295 "connected to a single " 296 "m0_halon_interface.",
304 "{.no_id = "FID_F", ...}",
324 "Ignoring M0_NC_FAILED as " 325 "it's the 1st notification " 360 req->heq_git_rev_id,
req->heq_generation,
req->heq_pid);
363 "process_fid="FID_F" git_rev_id=%s generation=%" PRIu64 " " 366 req->heq_generation,
req->heq_pid);
369 req->heq_rpc_endpoint,
370 &
req->heq_process_fid,
373 req->heq_first_request);
398 const char *
ep = &
buf[0];
427 const char *
ep = &
buf[0];
445 const char *
ep = &
buf[0];
463 const char *
ep = &
buf[0];
483 const char *
ep = &
buf[0];
502 const char *
ep = &
buf[0];
517 const char *
ep = &
buf[0];
520 M0_ENTRY(
"hii=%p ha=%p hl=%p ep=%s", hii, ha, hl,
ep);
524 M0_LEAVE(
"hii=%p ha=%p hl=%p ep=%s", hii, ha, hl,
ep);
532 const char *
ep = &
buf[0];
535 M0_ENTRY(
"hii=%p ha=%p hl=%p ep=%s", hii, ha, hl,
ep);
539 M0_LEAVE(
"hii=%p ha=%p hl=%p ep=%s", hii, ha, hl,
ep);
558 .sd_name =
"M0_HALON_INTERFACE_STATE_UNINITIALISED",
562 .sd_name =
"M0_HALON_INTERFACE_STATE_INITIALISED",
567 .sd_name =
"M0_HALON_INTERFACE_STATE_WORKING",
572 .sd_name =
"M0_HALON_INTERFACE_STATE_FINALISED",
578 .
scf_name =
"m0_halon_interface_internal::hii_sm",
584 const char *build_git_rev_id,
585 const char *build_configure_opts,
586 const char *debug_options,
590 bool disable_compat_check;
593 disable_compat_check = debug_options !=
NULL &&
594 strstr(debug_options,
"disable-compatibility-check") !=
NULL;
596 build_configure_opts,
597 disable_compat_check))
601 *hi_out = calloc(1,
sizeof **hi_out);
602 hii = calloc(1,
sizeof *hii);
603 if (*hi_out ==
NULL || hii ==
NULL) {
608 (*hi_out)->hif_internal = hii;
609 (*hi_out)->hif_internal->
hii_hi = *hi_out;
610 m0_halon_interface_internal_bob_init(hii);
633 hii =
hi->hif_internal;
640 m0_halon_interface_internal_bob_fini(hii);
709 .hdc_enable_keepalive =
true,
710 .hdc_enable_fvec =
true,
723 .rhia_dtm = (
void*)1,
724 .rhia_mdstore = (
void*)1,
864 .
ml_name =
"M0_HALON_INTERFACE_LEVEL_ASSIGNS",
869 .ml_name =
"M0_HALON_INTERFACE_LEVEL_NET_DOMAIN",
874 .ml_name =
"M0_HALON_INTERFACE_LEVEL_NET_BUFFER_POOL",
879 .ml_name =
"M0_HALON_INTERFACE_LEVEL_REQH_INIT",
884 .ml_name =
"M0_HALON_INTERFACE_LEVEL_REQH_START",
889 .ml_name =
"M0_HALON_INTERFACE_LEVEL_RPC_MACHINE",
894 .ml_name =
"M0_HALON_INTERFACE_LEVEL_HA_INIT",
899 .ml_name =
"M0_HALON_INTERFACE_LEVEL_DISPATCHER",
904 .ml_name =
"M0_HALON_INTERFACE_LEVEL_HA_START",
909 .ml_name =
"M0_HALON_INTERFACE_LEVEL_HA_CONNECT",
914 .ml_name =
"M0_HALON_INTERFACE_LEVEL_INSTANCE_SET",
919 .ml_name =
"M0_HALON_INTERFACE_LEVEL_EVENTS_STARTING",
924 .ml_name =
"M0_HALON_INTERFACE_LEVEL_RM_SETUP",
929 .ml_name =
"M0_HALON_INTERFACE_LEVEL_SPIEL_INIT",
934 .ml_name =
"M0_HALON_INTERFACE_LEVEL_SNS_CM_TRIGGER_FOPS",
939 .ml_name =
"M0_HALON_INTERFACE_LEVEL_EVENTS_STARTED",
944 .ml_name =
"M0_HALON_INTERFACE_LEVEL_STARTED",
949 const char *local_rpc_endpoint,
951 const struct m0_fid *ha_service_fid,
952 const struct m0_fid *rm_service_fid,
953 void (*entrypoint_request_cb)
956 const char *remote_rpc_endpoint,
958 const char *git_rev_id,
961 void (*msg_received_cb)
966 void (*msg_is_delivered_cb)
970 void (*msg_is_not_delivered_cb)
974 void (*link_connected_cb)
978 void (*link_reused_cb)
982 void (*link_absent_cb)
985 void (*link_is_disconnecting_cb)
988 void (*link_disconnected_cb)
996 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1044 M0_ASSERT(m0_halon_interface_internal_bob_check(hii));
1064 const struct m0_fid *confd_fid_data,
1065 const char **confd_eps_data,
1066 uint32_t confd_quorum,
1067 const struct m0_fid *rm_fid,
1073 "confd_quorum=%"PRIu32" rm_fid="FID_F" rm_eps=%s",
1074 hi,
U128_P(req_id),
rc, confd_nr, confd_quorum,
1077 if (
hi->hif_internal->hii_cfg.hic_log_entrypoint) {
1079 "confd_quorum=%"PRIu32" rm_fid="FID_F" rm_eps=%s",
1080 U128_P(req_id),
rc, confd_nr, confd_quorum,
1084 .hae_quorum = confd_quorum,
1086 .af_count = confd_nr,
1087 .af_elems = (
struct m0_fid *)confd_fid_data,
1089 .hae_confd_eps = confd_eps_data,
1090 .hae_active_rm_fid = rm_fid ==
NULL ?
M0_FID0 : *rm_fid,
1091 .hae_active_rm_ep = (
char *)rm_eps,
1106 const char *
ep = &
buf[0];
1108 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1112 M0_ENTRY(
"hi=%p ha=%p hl=%p ep=%s msg=%p epoch=%" PRIu64 " tag=%p",
1131 const char *
ep = &
buf[0];
1133 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1164 const char *
ep = &
buf[0];
1166 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1194 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1210 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1216 hi, hii,
reqh, !!working);
1226 M0_PRE(m0_halon_interface_internal_bob_check(hii));
1242 M0_PRE(m0_halon_interface_internal_bob_check(
hi->hif_internal));
1244 motr = &
hi->hif_internal->hii_instance;
1255 #undef M0_TRACE_SUBSYSTEM
M0_INTERNAL uint64_t m0_process(void)
struct m0_ha_dispatcher_cfg hic_dispatcher_cfg
struct m0_fid hic_process_fid
struct m0_ha_dispatcher hii_dispatcher
void m0_rpc_machine_fini(struct m0_rpc_machine *machine)
struct m0_spiel hii_spiel
M0_INTERNAL void m0_reqh_services_terminate(struct m0_reqh *reqh)
void m0_net_domain_fini(struct m0_net_domain *dom)
void m0_halon_interface_stop(struct m0_halon_interface *hi)
M0_INTERNAL struct m0_ha_link * m0_ha_connect(struct m0_ha *ha)
M0_INTERNAL void m0_conf_ha_service_event_post(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_fid *source_process_fid, const struct m0_fid *source_service_fid, const struct m0_fid *service_fid, uint64_t pid, enum m0_conf_ha_service_event event, enum m0_conf_service_type service_type)
struct m0_ha_msg_nvec_array hmnv_arr
M0_INTERNAL enum m0_ha_msg_type m0_ha_msg_type_get(const struct m0_ha_msg *msg)
static const struct m0_ha_ops halon_interface_ha_ops
struct m0_ha_cfg hic_ha_cfg
M0_INTERNAL void m0_ha_fini(struct m0_ha *ha)
struct m0_halon_interface_cfg hii_cfg
int m0_halon_interface_start(struct m0_halon_interface *hi, const char *local_rpc_endpoint, const struct m0_fid *process_fid, const struct m0_fid *ha_service_fid, const struct m0_fid *rm_service_fid, void(*entrypoint_request_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, const char *remote_rpc_endpoint, const struct m0_fid *process_fid, const char *git_rev_id, uint64_t pid, bool first_request), void(*msg_received_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t tag), void(*msg_is_delivered_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, uint64_t tag), void(*msg_is_not_delivered_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, uint64_t tag), void(*link_connected_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, struct m0_ha_link *link), void(*link_reused_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, struct m0_ha_link *link), void(*link_absent_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id), void(*link_is_disconnecting_cb)(struct m0_halon_interface *hi, struct m0_ha_link *link), void(*link_disconnected_cb)(struct m0_halon_interface *hi, struct m0_ha_link *link))
int m0_halon_interface_init(struct m0_halon_interface **hi_out, const char *build_git_rev_id, const char *build_configure_opts, const char *debug_options, const char *node_uuid)
#define M0_REQH_INIT(reqh,...)
M0_INTERNAL void m0_ha_rpc_endpoint(struct m0_ha *ha, struct m0_ha_link *hl, char *buf, m0_bcount_t buf_len)
struct m0_rpc_machine hii_rpc_machine
static struct io_request req
static uint64_t tag(uint8_t code, uint64_t id)
#define M0_LOG(level,...)
void(* hic_msg_received_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t tag)
enum m0_trace_level level
M0_INTERNAL void m0_sns_cm_rebalance_trigger_fop_init(void)
void m0_halon_interface_disconnect(struct m0_halon_interface *hi, struct m0_ha_link *hl)
bool hic_disable_compat_check
void(* hic_msg_is_not_delivered_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, uint64_t tag)
void m0_halon_interface_delivered(struct m0_halon_interface *hi, struct m0_ha_link *hl, const struct m0_ha_msg *msg)
M0_INTERNAL int m0_ha_start(struct m0_ha *ha)
struct m0_reqh_service * hii_rm_service
void m0_spiel_fini(struct m0_spiel *spiel)
M0_INTERNAL struct m0_ha_link * m0_ha_outgoing_link(struct m0_ha *ha)
static void halon_interface_parse_debug_options(struct m0_halon_interface *hi, const char *debug_options)
M0_INTERNAL void m0_ha_send(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
struct m0_net_buffer_pool hii_net_buffer_pool
struct m0_ha_msg_data hm_data
M0_INTERNAL uint8_t m0_fid_tget(const struct m0_fid *fid)
struct m0_ha_note hmna_arr[M0_HA_STATE_UPDATE_LIMIT]
static const struct m0_bob_type halon_interface_bob_type
static struct m0_sm_state_descr halon_interface_states[]
const char * hic_build_configure_opts
static void halon_interface_service_event(struct m0_halon_interface_internal *hii, enum m0_conf_ha_service_event event)
M0_INTERNAL struct m0 * m0_get(void)
M0_INTERNAL int m0_thread_adopt(struct m0_thread *thread, struct m0 *instance)
int m0_init(struct m0 *instance)
M0_INTERNAL void m0_reqh_fini(struct m0_reqh *reqh)
static struct m0_halon_interface_internal * halon_interface_ha2hii(struct m0_ha *ha)
struct m0_fop_getxattr_rep * rep
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
static void halon_interface_link_connected_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
static void halon_interface_link_is_disconnecting_cb(struct m0_ha *ha, struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_dispatcher_handle(struct m0_ha_dispatcher *hd, struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
void(* hao_entrypoint_request)(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
struct m0_fid hic_rm_service_fid
M0_INTERNAL void m0_reqh_shutdown_wait(struct m0_reqh *reqh)
M0_INTERNAL void m0_ha_disconnect(struct m0_ha *ha)
M0_INTERNAL void m0_sns_cm_repair_trigger_fop_init(void)
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
M0_INTERNAL void m0_halon_interface_thread_shun(void)
const char * bi_configure_opts
struct m0_rpc_machine * m0_halon_interface_rpc_machine(struct m0_halon_interface *hi)
return M0_ERR(-EOPNOTSUPP)
const struct m0_build_info * m0_build_info_get(void)
M0_INTERNAL void m0_ha_flush(struct m0_ha *ha, struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_stop(struct m0_ha *ha)
M0_INTERNAL void m0_ha_process_failed(struct m0_ha *ha, const struct m0_fid *process_fid)
M0_INTERNAL void m0_ha_delivered(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg)
static void halon_interface_msg_is_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
const struct m0_fid_type cot_ftype
M0_INTERNAL void m0_reqh_service_quit(struct m0_reqh_service *svc)
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
M0_INTERNAL int m0_rpc_net_buffer_pool_setup(struct m0_net_domain *ndom, struct m0_net_buffer_pool *app_pool, uint32_t bufs_nr, uint32_t tm_nr)
void m0_halon_interface_send(struct m0_halon_interface *hi, struct m0_ha_link *hl, const struct m0_ha_msg *msg, uint64_t *tag)
void m0_sm_state_set(struct m0_sm *mach, int state)
void(* hic_link_is_disconnecting_cb)(struct m0_halon_interface *hi, struct m0_ha_link *link)
void(* hic_msg_is_delivered_cb)(struct m0_halon_interface *hi, struct m0_ha_link *hl, uint64_t tag)
void m0_node_uuid_string_set(const char *uuid)
static bool halon_interface_is_working(struct m0_halon_interface_internal *hii)
#define bob_of(ptr, type, field, bt)
void m0_halon_interface_entrypoint_reply(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, int rc, uint32_t confd_nr, const struct m0_fid *confd_fid_data, const char **confd_eps_data, uint32_t confd_quorum, const struct m0_fid *rm_fid, const char *rm_eps)
struct m0_ha_note hii_nvec[HALON_INTERFACE_NVEC_SIZE_MAX]
M0_BOB_DEFINE(static, &halon_interface_bob_type, m0_halon_interface_internal)
M0_INTERNAL void m0_module_setup(struct m0_module *module, const char *name, const struct m0_modlev *level, int level_nr, struct m0 *instance)
static void halon_interface_entrypoint_replied_cb(struct m0_ha *ha, struct m0_ha_entrypoint_rep *rep)
M0_INTERNAL int m0_rpc_machine_init(struct m0_rpc_machine *machine, struct m0_net_domain *net_dom, const char *ep_addr, struct m0_reqh *reqh, struct m0_net_buffer_pool *receive_pool, uint32_t colour, m0_bcount_t msg_size, uint32_t queue_len)
struct m0_sm_group hii_sm_group
uint64_t hmnv_ignore_same_state
struct m0_net_xprt * m0_net_xprt_default_get(void)
static void halon_interface_link_disconnected_cb(struct m0_ha *ha, struct m0_ha_link *hl)
struct m0_spiel * m0_halon_interface_spiel(struct m0_halon_interface *hi)
const char * bi_git_rev_id
static void halon_interface_link_reused_cb(struct m0_ha *ha, const struct m0_uint128 *req_id, struct m0_ha_link *hl)
M0_INTERNAL void m0_ha_dispatcher_fini(struct m0_ha_dispatcher *hd)
void(* hic_link_absent_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id)
M0_INTERNAL uint64_t m0_ha_msg_tag(const struct m0_ha_msg *msg)
M0_INTERNAL int m0_reqh_service_setup(struct m0_reqh_service **out, struct m0_reqh_service_type *stype, struct m0_reqh *reqh, struct m0_reqh_context *rctx, const struct m0_fid *fid)
static void halon_interface_msg_is_not_delivered_cb(struct m0_ha *ha, struct m0_ha_link *hl, uint64_t tag)
M0_INTERNAL void m0_ha_disconnect_incoming(struct m0_ha *ha, struct m0_ha_link *hl)
M0_INTERNAL void m0_thread_shun(void)
const char * hic_build_git_rev_id
static struct m0_sm_conf halon_interface_sm_conf
enum m0_ha_entrypoint_control hae_control
static void halon_interface_process_event(struct m0_halon_interface_internal *hii, enum m0_conf_ha_process_event event)
M0_INTERNAL int m0_ha_dispatcher_init(struct m0_ha_dispatcher *hd, struct m0_ha_dispatcher_cfg *hd_cfg)
struct m0_ha_link * i_ha_link
M0_INTERNAL bool m0_fid_eq(const struct m0_fid *fid0, const struct m0_fid *fid1)
void(* hic_link_connected_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, struct m0_ha_link *link)
struct m0_reqh_service_type m0_rms_type
M0_INTERNAL int m0_halon_interface_thread_adopt(struct m0_halon_interface *hi, struct m0_thread *thread)
M0_INTERNAL void m0_reqh_start(struct m0_reqh *reqh)
M0_INTERNAL void m0_sns_cm_rebalance_trigger_fop_fini(void)
static void halon_interface_process_failure_check(struct m0_halon_interface_internal *hii, struct m0_ha_msg *msg)
#define M0_MAGIX_OFFSET(type, field)
int m0_net_domain_init(struct m0_net_domain *dom, const struct m0_net_xprt *xprt)
union m0_ha_msg_data::@212 u
static const struct m0_modlev halon_interface_levels[]
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
M0_INTERNAL int m0_ha_init(struct m0_ha *ha, struct m0_ha_cfg *ha_cfg)
M0_INTERNAL void m0_conf_ha_process_event_post(struct m0_ha *ha, struct m0_ha_link *hl, const struct m0_fid *process_fid, uint64_t pid, enum m0_conf_ha_process_event event, enum m0_conf_ha_process_type type)
struct m0_fid hic_ha_service_fid
void(* hic_link_reused_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, struct m0_ha_link *link)
void(* hic_link_disconnected_cb)(struct m0_halon_interface *hi, struct m0_ha_link *link)
void(* hic_entrypoint_request_cb)(struct m0_halon_interface *hi, const struct m0_uint128 *req_id, const char *remote_rpc_endpoint, const struct m0_fid *process_fid, const char *git_rev_id, uint64_t pid, bool first_request)
struct m0_reqh * m0_halon_interface_reqh(struct m0_halon_interface *hi)
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
struct m0_ha_link * hii_outgoing_link
struct m0_halon_interface * hii_hi
#define M0_ASSERT_INFO(cond, fmt,...)
struct m0_net_domain hii_net_domain
void m0_ha_entrypoint_reply(struct m0_ha *ha, const struct m0_uint128 *req_id, const struct m0_ha_entrypoint_rep *rep, struct m0_ha_link **hl_ptr)
static void halon_interface_msg_received_cb(struct m0_ha *ha, struct m0_ha_link *hl, struct m0_ha_msg *msg, uint64_t tag)
const struct m0_conf_obj_type M0_CONF_PROCESS_TYPE
static void halon_interface_level_leave(struct m0_module *module)
struct m0_module hii_module
M0_INTERNAL void m0_ha_msg_debug_print(const struct m0_ha_msg *msg, const char *prefix)
static void halon_interface_link_absent_cb(struct m0_ha *ha, const struct m0_uint128 *req_id)
void m0_rpc_net_buffer_pool_cleanup(struct m0_net_buffer_pool *app_pool)
char * hic_local_rpc_endpoint
m0_bcount_t hic_max_msg_size
static bool halon_interface_is_compatible(struct m0_halon_interface *hi, const char *build_git_rev_id, const char *build_configure_opts, bool disable_compat_check)
M0_INTERNAL void m0_sns_cm_repair_trigger_fop_fini(void)
static struct m0_rpc_machine rpc_machine
M0_INTERNAL void m0_module_fini(struct m0_module *module, int level)
static void halon_interface_entrypoint_request_cb(struct m0_ha *ha, const struct m0_ha_entrypoint_req *req, const struct m0_uint128 *req_id)
static const char * process_fid
int m0_spiel_init(struct m0_spiel *spiel, struct m0_reqh *reqh)
void m0_halon_interface_fini(struct m0_halon_interface *hi)
static int halon_interface_level_enter(struct m0_module *module)
M0_INTERNAL int m0_module_init(struct m0_module *module, int level)
#define M0_IMPOSSIBLE(fmt,...)
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)