Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-8082 mgmt: missing collect req put #6340

Merged
merged 3 commits into from
Aug 6, 2021
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
1 change: 0 additions & 1 deletion src/cart/crt_iv.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ crt_ivf_pending_request_add(struct crt_ivns_internal *ivns_internal,
iv_ops->ivo_on_put(ivns_internal, &iv_info->ifc_iv_value,
iv_info->ifc_user_priv);

IVNS_ADDREF(iv_info->ifc_ivns_internal);
pending_fetch->pf_cb_info = iv_info;

d_list_add_tail(&pending_fetch->pf_link,
Expand Down
2 changes: 2 additions & 0 deletions src/cart/crt_swim.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static void crt_swim_srv_cb(crt_rpc_t *rpc)
rpc_out->rc = rc;
rpc_out->pad = 0;
rc = crt_reply_send(rpc);
D_FREE(rpc_out->upds.ca_arrays);
if (rc)
D_TRACE_ERROR(rpc, "send reply: "DF_RC" failed: "DF_RC"\n",
DP_RC(rpc_out->rc), DP_RC(rc));
Expand Down Expand Up @@ -514,6 +515,7 @@ static int crt_swim_send_reply(struct swim_context *ctx, swim_id_t from,
* So, we need to decrement reference.
* Was incremented in crt_swim_srv_cb().
*/
D_FREE(rpc_out->upds.ca_arrays);
rpc_priv = container_of(rpc, struct crt_rpc_priv, crp_pub);
RPC_DECREF(rpc_priv);
return rc;
Expand Down
2 changes: 1 addition & 1 deletion src/container/srv_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ cont_child_free_ref(struct daos_llink *llink)
vos_cont_close(cont->sc_hdl);
ds_pool_child_put(cont->sc_pool);
daos_csummer_destroy(&cont->sc_csummer);

D_FREE(cont->sc_snapshots);
ABT_cond_free(&cont->sc_dtx_resync_cond);
ABT_mutex_free(&cont->sc_mutex);
D_FREE(cont);
Expand Down
33 changes: 3 additions & 30 deletions src/mgmt/srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,8 @@ ds_mgmt_params_set_hdlr(crt_rpc_t *rpc)
tc_in->tps_value_extra = ps_in->ps_value_extra;

rc = dss_rpc_send(tc_req);
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}

out = crt_reply_get(tc_req);
rc = out->srv_rc;
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}
crt_req_decref(tc_req);
out:
out = crt_reply_get(rpc);
out->srv_rc = rc;
Expand Down Expand Up @@ -262,17 +253,8 @@ ds_mgmt_profile_hdlr(crt_rpc_t *rpc)
tc_in->p_op = in->p_op;
tc_in->p_avg = in->p_avg;
rc = dss_rpc_send(tc_req);
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}

out = crt_reply_get(tc_req);
rc = out->p_rc;
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}
crt_req_decref(tc_req);
out:
D_DEBUG(DB_MGMT, "profile hdlr: rc "DF_RC"\n", DP_RC(rc));
out = crt_reply_get(rpc);
Expand Down Expand Up @@ -310,17 +292,8 @@ ds_mgmt_mark_hdlr(crt_rpc_t *rpc)

tc_in->m_mark = in->m_mark;
rc = dss_rpc_send(tc_req);
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}

out = crt_reply_get(tc_req);
rc = out->m_rc;
if (rc != 0) {
crt_req_decref(tc_req);
D_GOTO(out, rc);
}
crt_req_decref(tc_req);
liuxuezhao marked this conversation as resolved.
Show resolved Hide resolved
out:
D_DEBUG(DB_MGMT, "mark hdlr: rc "DF_RC"\n", DP_RC(rc));
out = crt_reply_get(rpc);
Expand Down
10 changes: 6 additions & 4 deletions src/mgmt/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ ds_mgmt_tgt_pool_create_ranks(uuid_t pool_uuid, char *tgt_dev,
crt_rpc_t *tc_req;
crt_opcode_t opc;
struct mgmt_tgt_create_in *tc_in;
struct mgmt_tgt_create_out *tc_out;
struct mgmt_tgt_create_out *tc_out = NULL;
d_rank_t *tc_out_ranks;
uuid_t *tc_out_uuids;
unsigned int i;
Expand Down Expand Up @@ -162,12 +162,14 @@ ds_mgmt_tgt_pool_create_ranks(uuid_t pool_uuid, char *tgt_dev,
D_DEBUG(DB_TRACE, "fill ranks %d idx %d "DF_UUID"\n",
tc_out_ranks[i], idx, DP_UUID(tc_out_uuids[i]));
}
D_FREE(tc_out->tc_tgt_uuids.ca_arrays);
D_FREE(tc_out->tc_ranks.ca_arrays);

rc = DER_SUCCESS;

decref:
if (tc_out) {
D_FREE(tc_out->tc_tgt_uuids.ca_arrays);
D_FREE(tc_out->tc_ranks.ca_arrays);
}

crt_req_decref(tc_req);
if (rc) {
rc_cleanup = ds_mgmt_tgt_pool_destroy_ranks(pool_uuid,
Expand Down
3 changes: 2 additions & 1 deletion src/object/cli_ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ obj_ec_recov_task_fini(struct obj_reasb_req *reasb_req)
struct obj_ec_fail_info *fail_info = reasb_req->orr_fail;
uint32_t i;

for (i = 0; i < fail_info->efi_nrecx_lists; i++)
for (i = 0; i < fail_info->efi_stripe_sgls_nr; i++)
d_sgl_fini(&fail_info->efi_stripe_sgls[i], true);
D_FREE(fail_info->efi_stripe_sgls);

Expand Down Expand Up @@ -2250,6 +2250,7 @@ obj_ec_recov_task_init(struct obj_reasb_req *reasb_req, daos_obj_id_t oid,
D_ALLOC_ARRAY(fail_info->efi_stripe_sgls, iod_nr);
if (fail_info->efi_stripe_sgls == NULL)
D_GOTO(out, rc = -DER_NOMEM);
fail_info->efi_stripe_sgls_nr = iod_nr;

recx_ep_nr = 0;
for (i = 0; i < iod_nr; i++) {
Expand Down
4 changes: 4 additions & 0 deletions src/object/cli_obj.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ obj_layout_create(struct dc_object *obj, bool refresh)

obj_shard = &obj->cob_shards->do_shards[i];
obj_shard->do_shard = layout->ol_shards[i].po_shard;
obj_shard->do_shard_idx = i;
obj_shard->do_target_id = layout->ol_shards[i].po_target;
obj_shard->do_fseq = layout->ol_shards[i].po_fseq;
obj_shard->do_rebuilding = layout->ol_shards[i].po_rebuilding;
Expand Down Expand Up @@ -1516,6 +1517,7 @@ dc_obj_layout_get(daos_handle_t oh, struct daos_obj_layout **p_layout)
}
*p_layout = layout;
out:
obj_decref(obj);
if (rc && layout != NULL)
daos_obj_layout_free(layout);
return rc;
Expand Down Expand Up @@ -5610,6 +5612,8 @@ dc_obj_verify(daos_handle_t oh, daos_epoch_t *epochs, unsigned int nr)
if (dova[i].list_buf != dova[i].inline_buf)
D_FREE(dova[i].list_buf);

daos_iov_free(&dova[i].cursor.dkey);
daos_iov_free(&dova[i].cursor.iod.iod_name);
D_FREE(dova[i].fetch_buf);
}

Expand Down
4 changes: 2 additions & 2 deletions src/object/cli_shard.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static inline struct dc_obj_layout *
obj_shard2layout(struct dc_obj_shard *shard)
{
return container_of(shard, struct dc_obj_layout,
do_shards[shard->do_shard]);
do_shards[shard->do_shard_idx]);
}

void
Expand Down Expand Up @@ -80,7 +80,7 @@ dc_obj_shard_open(struct dc_object *obj, daos_unit_oid_t oid,
shard->do_target_idx = map_tgt->ta_comp.co_index;
shard->do_obj = obj;
shard->do_co_hdl = obj->cob_coh;
obj_shard_addref(shard);
obj_shard_addref(shard); /* release this until obj_layout_free */

D_SPIN_LOCK(&obj->cob_spin);
obj->cob_shards->do_open_count++;
Expand Down
1 change: 1 addition & 0 deletions src/object/obj_ec.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ struct obj_ec_fail_info {
* it contains ((k + p) * cell_byte_size) memory.
*/
d_sg_list_t *efi_stripe_sgls;
uint32_t efi_stripe_sgls_nr;
/* For each daos_recx_ep in efi_stripe_lists will create one recovery
* task to fetch the data from servers.
*/
Expand Down
5 changes: 3 additions & 2 deletions src/object/obj_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ extern unsigned int srv_io_mode;
struct dc_obj_shard {
/** refcount */
unsigned int do_ref;
uint32_t do_target_rank;
/** object id */
daos_unit_oid_t do_id;
/** container handler of the object */
daos_handle_t do_co_hdl;
uint8_t do_target_idx; /* target VOS index in node */
uint32_t do_target_rank;
struct pl_obj_shard do_pl_shard;
/** point back to object */
struct dc_object *do_obj;
uint32_t do_shard_idx;
uint8_t do_target_idx; /* target VOS index in node */
};

#define do_shard do_pl_shard.po_shard
Expand Down
70 changes: 30 additions & 40 deletions src/object/srv_obj_migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ obj_tree_destory_cb(daos_handle_t ih, d_iov_t *key_iov,
if (rc)
D_ERROR("dbtree_destroy, cont "DF_UUID" failed: "DF_RC"\n",
DP_UUID(*(uuid_t *)key_iov->iov_buf), DP_RC(rc));

return rc;
}

Expand All @@ -131,64 +130,47 @@ obj_tree_destroy(daos_handle_t btr_hdl)
return rc;
}

/* Create tree root by key_iov */
static int
tree_cache_create_internal(daos_handle_t toh, unsigned int tree_class,
d_iov_t *key_iov, struct tree_cache_root **rootp)
container_tree_create(daos_handle_t toh, uuid_t uuid,
struct tree_cache_root **rootp)
{
d_iov_t key_iov;
d_iov_t val_iov;
struct umem_attr uma;
struct tree_cache_root root;
struct btr_root *broot;
struct tree_cache_root root = { 0 };
struct tree_cache_root *tmp_root;
int rc;

D_ALLOC_PTR(broot);
if (broot == NULL)
return -DER_NOMEM;
d_iov_set(&key_iov, uuid, sizeof(uuid_t));
d_iov_set(&val_iov, &root, sizeof(root));
rc = dbtree_update(toh, &key_iov, &val_iov);
if (rc)
return rc;

d_iov_set(&val_iov, NULL, 0);
rc = dbtree_lookup(toh, &key_iov, &val_iov);
if (rc)
D_GOTO(out, rc);

tmp_root = val_iov.iov_buf;

memset(&root, 0, sizeof(root));
root.root_hdl = DAOS_HDL_INVAL;
memset(&uma, 0, sizeof(uma));
uma.uma_id = UMEM_CLASS_VMEM;

rc = dbtree_create_inplace(tree_class, BTR_FEAT_DIRECT_KEY, 32,
&uma, broot, &root.root_hdl);
rc = dbtree_create_inplace(DBTREE_CLASS_NV, BTR_FEAT_DIRECT_KEY, 32,
&uma, &tmp_root->btr_root, &tmp_root->root_hdl);
if (rc) {
D_ERROR("failed to create rebuild tree: "DF_RC"\n", DP_RC(rc));
D_FREE(broot);
D_GOTO(out, rc);
}

d_iov_set(&val_iov, &root, sizeof(root));
rc = dbtree_update(toh, key_iov, &val_iov);
if (rc)
D_GOTO(out, rc);
*rootp = tmp_root;

d_iov_set(&val_iov, NULL, 0);
rc = dbtree_lookup(toh, key_iov, &val_iov);
if (rc)
D_GOTO(out, rc);

*rootp = val_iov.iov_buf;
D_ASSERT(*rootp != NULL);
out:
if (rc < 0 && daos_handle_is_valid(root.root_hdl))
dbtree_destroy(root.root_hdl, NULL);
if (rc < 0)
dbtree_delete(toh, BTR_PROBE_EQ, &key_iov, NULL);
return rc;
}

static int
container_tree_create(daos_handle_t toh, uuid_t uuid,
struct tree_cache_root **rootp)
{
d_iov_t key_iov;

d_iov_set(&key_iov, uuid, sizeof(uuid_t));

return tree_cache_create_internal(toh, DBTREE_CLASS_NV, &key_iov,
rootp);
}

int
obj_tree_lookup(daos_handle_t toh, uuid_t co_uuid, daos_unit_oid_t oid,
d_iov_t *val_iov)
Expand Down Expand Up @@ -2796,6 +2778,14 @@ migrate_cont_iter_cb(daos_handle_t ih, d_iov_t *key_iov,
D_DEBUG(DB_REBUILD, "iter cont "DF_UUID"/%"PRIx64" finish.\n",
DP_UUID(cont_uuid), ih.cookie);

rc = dbtree_destroy(root->root_hdl, NULL);
if (rc) {
/* Ignore the DRAM migrate object tree for the moment, since
* it does not impact the migration on the storage anyway
*/
D_ERROR("dbtree_destroy failed: "DF_RC"\n", DP_RC(rc));
}

/* Snapshot fetch will yield the ULT, let's reprobe before delete */
d_iov_set(&tmp_iov, cont_uuid, sizeof(uuid_t));
rc = dbtree_iter_probe(ih, BTR_PROBE_EQ, DAOS_INTENT_MIGRATION,
Expand Down
3 changes: 2 additions & 1 deletion src/pool/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3310,7 +3310,7 @@ ds_pool_target_update_state(uuid_t pool_uuid, d_rank_list_t *ranks,
crt_endpoint_t ep;
struct dss_module_info *info = dss_get_module_info();
crt_rpc_t *rpc;
struct pool_target_addr_list list;
struct pool_target_addr_list list = { 0 };
struct pool_add_in *in;
struct pool_add_out *out;
crt_opcode_t opcode;
Expand Down Expand Up @@ -3390,6 +3390,7 @@ ds_pool_target_update_state(uuid_t pool_uuid, d_rank_list_t *ranks,
out_rpc:
crt_req_decref(rpc);
out_client:
pool_target_addr_list_free(&list);
rsvc_client_fini(&client);
return rc;
}
Expand Down
1 change: 1 addition & 0 deletions src/rebuild/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ rebuild_obj_scan_cb(daos_handle_t ch, vos_iter_entry_t *ent,
still_needed = pl_obj_layout_contains(rpt->rt_pool->sp_map,
layout, myrank, mytarget,
oid.id_shard);
pl_obj_layout_free(layout);
if (!still_needed) {
struct rebuild_pool_tls *tls;

Expand Down