Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

CORTX-30371 fis: enable FI on both motr clients and servers #2103

Merged
merged 7 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conf/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ M0_INTERNAL int m0_conf_process2service_get(struct m0_confc *confc,
}
m0_conf_diter_fini(&it);
m0_confc_close(pobj);
return m0_fid_is_set(sfid) ? M0_RC(rc) : M0_ERR(-ENOENT);
return m0_fid_is_set(sfid) ? M0_RC(rc) : M0_RC(-ENOENT);
}

/* --------------------------------- >8 --------------------------------- */
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ AC_SUBST([ENABLE_COVERAGE], [$enable_coverage])
AC_ARG_ENABLE([finject],
AS_HELP_STRING([--disable-finject],[disable fault injection support]),
[],
[enable_finject=$enable_dev_mode]
[enable_finject=yes]
)
AS_IF([test x$enable_finject = xyes],
AC_DEFINE([ENABLE_FAULT_INJECTION]))
huanghua78 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
6 changes: 6 additions & 0 deletions fis/fi_command_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
*
*/

#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_OTHER

#include "lib/trace.h"

#include "fis/fi_command_fom.h" /* m0_fi_command_fom_type_ops */
#include "fis/fi_command_fops.h"
Expand Down Expand Up @@ -47,6 +50,7 @@ M0_INTERNAL void m0_fi_command_fop_init(void)
{
extern struct m0_reqh_service_type m0_rpc_service_type;

M0_ENTRY();
M0_FOP_TYPE_INIT(&m0_fi_command_req_fopt,
.name = "Fault Injection Command",
.opcode = M0_FI_COMMAND_OPCODE,
Expand All @@ -65,11 +69,13 @@ M0_INTERNAL void m0_fi_command_fop_init(void)

M0_INTERNAL void m0_fi_command_fop_fini(void)
{
M0_ENTRY();
m0_fop_type_fini(&m0_fi_command_req_fopt);
m0_fop_type_fini(&m0_fi_command_rep_fopt);
}

/** @} end fis-dlspec */
#undef M0_TRACE_SUBSYSTEM

/*
* Local variables:
Expand Down
1 change: 1 addition & 0 deletions fis/fi_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct m0_reqh_fi_service {
M0_INTERNAL int m0_fis_register(void);
M0_INTERNAL void m0_fis_unregister(void);

extern struct m0_reqh_service_type m0_fis_type;
/** @} fis-dfspec */
#endif /* __MOTR_FIS_FI_SERVICE_H__ */

Expand Down
69 changes: 66 additions & 3 deletions motr/client_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "dtm0/service.h" /* m0_dtm0_service_find */
#include "dtm0/helper.h" /* m0_dtm_client_service_start */
#include "dtm0/cfg_default.h" /* m0_dtm0_domain_cfg_default_dup */
#include "fis/fi_service.h"

#include "motr/io.h" /* io_sm_conf */
#include "motr/client.h"
Expand Down Expand Up @@ -104,6 +105,7 @@ enum initlift_states {
IL_LAYOUT_DB,
IL_IDX_SERVICE,
IL_ROOT_FID, /* TODO: remove this m0t1fs ism */
IL_FIS,
IL_ADDB2,
IL_DTM0,
IL_INITIALISED,
Expand All @@ -125,6 +127,7 @@ static int initlift_idx_service(struct m0_sm *mach);
static int initlift_rootfid(struct m0_sm *mach);
static int initlift_addb2(struct m0_sm *mach);
static int initlift_dtm0(struct m0_sm *mach);
static int initlift_fis(struct m0_sm *mach);

/**
* State machine phases for client operations.
Expand Down Expand Up @@ -195,14 +198,20 @@ struct m0_sm_state_descr initlift_phases[] = {
},
[IL_ROOT_FID] = {
.sd_name = "retrieve-root-fid",
.sd_allowed = M0_BITS(IL_ADDB2,
.sd_allowed = M0_BITS(IL_FIS,
IL_IDX_SERVICE),
.sd_in = initlift_rootfid,
},
[IL_FIS] = {
.sd_name = "init/fini-fis",
.sd_allowed = M0_BITS(IL_ADDB2,
IL_ROOT_FID),
.sd_in = initlift_fis,
},
[IL_ADDB2] = {
.sd_name = "init/fini-addb2",
.sd_allowed = M0_BITS(IL_DTM0,
IL_ROOT_FID),
IL_FIS),
.sd_in = initlift_addb2,
},
[IL_DTM0] = {
Expand Down Expand Up @@ -249,7 +258,9 @@ struct m0_sm_trans_descr initlift_trans[] = {
IL_IDX_SERVICE},
{"retrieving-root-fid", IL_IDX_SERVICE,
IL_ROOT_FID},
{"initialising-addb2", IL_ROOT_FID,
{"initialising-fis", IL_ROOT_FID,
IL_FIS},
{"initialising-addb2", IL_FIS,
IL_ADDB2},
{"initialising-dtm0", IL_ADDB2, IL_DTM0},
{"initialised", IL_DTM0, IL_INITIALISED},
Expand All @@ -261,6 +272,8 @@ struct m0_sm_trans_descr initlift_trans[] = {
IL_ADDB2},

{"finalising-addb2", IL_ADDB2,
IL_FIS},
{"finalising-fis", IL_FIS,
IL_ROOT_FID},
{"finalising-root-fid", IL_ROOT_FID,
IL_IDX_SERVICE},
Expand Down Expand Up @@ -1435,6 +1448,56 @@ static int initlift_addb2(struct m0_sm *mach)
return M0_RC(initlift_get_next_floor(m0c));
}

static int initlift_fis(struct m0_sm *mach)
{
int rc = 0;
struct m0_client *m0c;
struct m0_reqh_service *service;
struct m0_reqh *reqh;
struct m0_fid sfid;

M0_ENTRY();
M0_PRE(mach != NULL);

m0c = bob_of(mach, struct m0_client, m0c_initlift_sm, &m0c_bobtype);
M0_ASSERT(m0c_invariant(m0c));
reqh = &m0c->m0c_reqh;

if (!m0_confc_is_inited(&reqh->rh_rconfc.rc_confc)) {
/* confd quorum is not possible. */
rc = M0_ERR(-EINVAL);
initlift_fail(rc, m0c);
goto exit;
}

/* Confc needs the lock to proceed. */
m0_sm_group_unlock(&m0c->m0c_sm_group);
rc = m0_conf_process2service_get(&reqh->rh_rconfc.rc_confc,
&reqh->rh_fid, M0_CST_FIS,
&sfid);
m0_sm_group_lock(&m0c->m0c_sm_group);
if (rc == -ENOENT)
return M0_RC(initlift_get_next_floor(m0c));
else if (rc != 0) {
initlift_fail(rc, m0c);
goto exit;
}
if (m0c->m0c_initlift_direction == STARTUP) {
rc = service_start(reqh, &sfid, &m0_fis_type, &service);
if (rc != 0)
initlift_fail(rc, m0c);
} else {
/* reqh_services_terminate is handled by rpc_fini.
* Reqh services are terminated not in reverse order because
* m0_reqh_services_terminate() terminates all services
* including rpc_service. Rpc_service starts in
* rpc_init() implicitly.
*/
}
exit:
return M0_RC(initlift_get_next_floor(m0c));
}

static int initlift_dtm0(struct m0_sm *mach)
{
int rc = 0;
Expand Down
3 changes: 3 additions & 0 deletions motr/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,8 @@ static int reqh_context_services_init(struct m0_reqh_context *rctx,
if (rctx->rc_services[i] == NULL ||
M0_IN(i, (M0_CST_HA, M0_CST_SSS)))
continue;
#if 0
/** TODO: Make it configurable based on motr config(conf.xc) */
if (i == M0_CST_FIS) {
if (!rctx->rc_fis_enabled)
/*
Expand All @@ -1168,6 +1170,7 @@ static int reqh_context_services_init(struct m0_reqh_context *rctx,
else
M0_LOG(M0_DEBUG, "FIS enabled by command opt.");
}
#endif
rc = cs_service_init(rctx->rc_services[i], rctx, &rctx->rc_reqh,
&rctx->rc_service_fids[i]);
M0_LOG(M0_DEBUG, "service: %s" FID_F " cs_service_init: %d",
Expand Down
3 changes: 3 additions & 0 deletions rpc/item.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,9 @@ M0_INTERNAL int m0_rpc_item_received(struct m0_rpc_item *item,
return M0_RC(-ENOENT);
item->ri_session = sess;

if (M0_FI_ENABLED("log"))
M0_LOG(M0_ALWAYS, ITEM_FMT" xid=%llu machine=%p", ITEM_ARG(item),
(unsigned long long)item->ri_header.osr_xid, machine);
/*
* If item is a request, then it may be the first arrival of the
* request item, or the same request may be sent again if resend
Expand Down