Skip to content

Commit

Permalink
DAOS-14884 pool: set the pool server handle before update (#13618)
Browse files Browse the repository at this point in the history
Set the pool server handler before IV update, to make sure
IV server checking accurate on the PS leader once step up finish.

Signed-off-by: Di Wang <di.wang@intel.com>
  • Loading branch information
wangdi committed Jan 19, 2024
1 parent 1ed8f1d commit be4402b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 64 deletions.
4 changes: 0 additions & 4 deletions src/pool/srv_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,6 @@ int ds_pool_iv_srv_hdl_invalidate(struct ds_pool *pool);
int ds_pool_iv_conn_hdl_fetch(struct ds_pool *pool);
int ds_pool_iv_conn_hdl_invalidate(struct ds_pool *pool, uuid_t hdl_uuid);

int ds_pool_iv_srv_hdl_fetch_non_sys(struct ds_pool *pool,
uuid_t *srv_cont_hdl,
uuid_t *srv_pool_hdl);

/*
* srv_metrics.c
*/
Expand Down
57 changes: 0 additions & 57 deletions src/pool/srv_iv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,63 +1496,6 @@ ds_pool_iv_srv_hdl_fetch(struct ds_pool *pool, uuid_t *pool_hdl_uuid,
return rc;
}

struct srv_hdl_ult_arg {
struct ds_pool *pool;
ABT_eventual eventual;
};

static void
pool_iv_srv_hdl_fetch_ult(void *data)
{
struct srv_hdl_ult_arg *arg = data;
int rc;

rc = ds_pool_iv_srv_hdl_fetch(arg->pool, NULL, NULL);

ABT_eventual_set(arg->eventual, (void *)&rc, sizeof(rc));
}

int
ds_pool_iv_srv_hdl_fetch_non_sys(struct ds_pool *pool, uuid_t *srv_cont_hdl,
uuid_t *srv_pool_hdl)
{
struct srv_hdl_ult_arg arg;
ABT_eventual eventual;
int *status;
int rc;

/* Fetch the capability from the leader. To avoid extra locks,
* all metadatas are maintained by xstream 0, so let's create
* an ULT on xstream 0 to let xstream 0 to handle capa fetch
* and update.
*/
rc = ABT_eventual_create(sizeof(*status), &eventual);
if (rc != ABT_SUCCESS)
return dss_abterr2der(rc);

arg.pool = pool;
arg.eventual = eventual;
rc = dss_ult_create(pool_iv_srv_hdl_fetch_ult, &arg, DSS_XS_SYS,
0, 0, NULL);
if (rc)
D_GOTO(out_eventual, rc);

rc = ABT_eventual_wait(eventual, (void **)&status);
if (rc != ABT_SUCCESS)
D_GOTO(out_eventual, rc = dss_abterr2der(rc));
if (*status != 0)
D_GOTO(out_eventual, rc = *status);

if (srv_cont_hdl)
uuid_copy(*srv_cont_hdl, pool->sp_srv_cont_hdl);
if (srv_pool_hdl)
uuid_copy(*srv_pool_hdl, pool->sp_srv_pool_hdl);

out_eventual:
ABT_eventual_free(&eventual);
return rc;
}

int
ds_pool_iv_prop_update(struct ds_pool *pool, daos_prop_t *prop)
{
Expand Down
10 changes: 7 additions & 3 deletions src/pool/srv_pool.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -1810,6 +1810,11 @@ pool_svc_step_up_cb(struct ds_rsvc *rsvc)
} else {
uuid_generate(pool_hdl_uuid);
uuid_generate(cont_hdl_uuid);
/* Only copy server handle to make is_from_srv() check correctly, and
* container server handle will not be copied here, otherwise
* ds_pool_iv_refresh_hdl will not open the server container handle.
*/
uuid_copy(svc->ps_pool->sp_srv_pool_hdl, pool_hdl_uuid);
}

rc = ds_pool_iv_srv_hdl_update(svc->ps_pool, pool_hdl_uuid,
Expand Down Expand Up @@ -4296,8 +4301,7 @@ ds_pool_query_handler(crt_rpc_t *rpc, int handler_version)
metrics = svc->ps_pool->sp_metrics[DAOS_POOL_MODULE];

/* See comment above, rebuild doesn't connect the pool */
if ((query_bits & DAOS_PO_QUERY_SPACE) &&
!is_pool_from_srv(in->pqi_op.pi_uuid, in->pqi_op.pi_hdl)) {
if (query_bits & DAOS_PO_QUERY_SPACE) {
rc = pool_space_query_bcast(rpc->cr_ctx, svc, in->pqi_op.pi_hdl,
&out->pqo_space);
if (unlikely(rc))
Expand Down

0 comments on commit be4402b

Please sign in to comment.