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

Commit

Permalink
Do reverse session cleanup in rpc_service_prepare_to_stop() instead.
Browse files Browse the repository at this point in the history
Originally, the reverse session cleanup is called in rpc_service_stop().
But this leads to: create new foms, init these foms, and try to
queue these foms while the rpc service is stopped.
This will cause the reverse session can be not cleaned up.

Add delay of one second before doing fini in the UT to avoid
some pending requests/foms are still active.

Signed-off-by: Hua Huang <hua.huang@seagate.com>
  • Loading branch information
Hua Huang authored and rkothiya committed Jul 6, 2022
1 parent e1ad436 commit 3af2fc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions rpc/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static int rpc_service_start(struct m0_reqh_service *service)
return 0;
}

static void rpc_service_stop(struct m0_reqh_service *service)
static void rpc_service_prepare_to_stop(struct m0_reqh_service *service)
{
struct m0_rpc_service *svc;

Expand All @@ -76,6 +76,10 @@ static void rpc_service_stop(struct m0_reqh_service *service)
rev_conn_tlist_fini(&svc->rps_rev_conns);
}

static void rpc_service_stop(struct m0_reqh_service *service)
{
}

static void rpc_service_fini(struct m0_reqh_service *service)
{
struct m0_rpc_service *svc;
Expand All @@ -95,7 +99,8 @@ static const struct m0_reqh_service_ops rpc_ops = {
.rso_start = rpc_service_start,
.rso_stop = rpc_service_stop,
.rso_fini = rpc_service_fini,
.rso_fop_accept = rpc_service_fop_accept
.rso_fop_accept = rpc_service_fop_accept,
.rso_prepare_to_stop = rpc_service_prepare_to_stop
};

static int rpc_service_allocate(struct m0_reqh_service **service,
Expand Down Expand Up @@ -266,7 +271,7 @@ m0_rpc_service_reverse_sessions_cleanup(struct m0_reqh_service *service)
false);
} m0_tlist_endfor;
m0_tl_teardown(rev_conn, &svc->rps_rev_conns, revc) {
if (revc->rcf_disc_wait.cl_group != NULL) {
if (m0_clink_is_armed(&revc->rcf_disc_wait)) {
m0_chan_wait(&revc->rcf_disc_wait);
m0_clink_fini(&revc->rcf_disc_wait);
}
Expand Down
1 change: 1 addition & 0 deletions sns/cm/repair/ut/flock.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static int test_setup(void)

static int test_fini(void)
{
m0_nanosleep(m0_time(1, 0), NULL);
m0_sns_cm_rm_fini(scm);
m0_cm_ast_run_thread_fini(cm);
cs_fini(&sctx);
Expand Down

0 comments on commit 3af2fc7

Please sign in to comment.