From be4402b995e27a488295e7ab322a1a35ec19be59 Mon Sep 17 00:00:00 2001 From: wangdi Date: Fri, 19 Jan 2024 07:33:30 -0800 Subject: [PATCH] DAOS-14884 pool: set the pool server handle before update (#13618) 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 --- src/pool/srv_internal.h | 4 --- src/pool/srv_iv.c | 57 ----------------------------------------- src/pool/srv_pool.c | 10 +++++--- 3 files changed, 7 insertions(+), 64 deletions(-) diff --git a/src/pool/srv_internal.h b/src/pool/srv_internal.h index c95f15cc715..f997d299f80 100644 --- a/src/pool/srv_internal.h +++ b/src/pool/srv_internal.h @@ -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 */ diff --git a/src/pool/srv_iv.c b/src/pool/srv_iv.c index 92970ff3d5f..a1969c67bd6 100644 --- a/src/pool/srv_iv.c +++ b/src/pool/srv_iv.c @@ -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) { diff --git a/src/pool/srv_pool.c b/src/pool/srv_pool.c index 6396e6bea59..8f857ea1e12 100644 --- a/src/pool/srv_pool.c +++ b/src/pool/srv_pool.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2016-2023 Intel Corporation. + * (C) Copyright 2016-2024 Intel Corporation. * * SPDX-License-Identifier: BSD-2-Clause-Patent */ @@ -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, @@ -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))