From b36b33818be55bad5cc22f4e0e01fd5de4522cc8 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 12 Dec 2013 15:52:59 -0500 Subject: [svn-r24535] - update to new IOD object_open API - change H5Oopen_by_token to take a transaction instead of a read context. --- examples/h5ff_client_dset.c | 6 ++-- examples/h5ff_client_links.c | 6 ++-- examples/h5ff_client_map.c | 12 ++++--- examples/h5ff_client_multiple_cont.c | 12 +++---- src/H5FF.c | 16 +++++----- src/H5FFpublic.h | 2 +- src/H5VLiod.c | 34 +++++++++++--------- src/H5VLiod_analysis.c | 2 +- src/H5VLiod_attr.c | 62 ++++++++++++++++++++---------------- src/H5VLiod_client.h | 2 +- src/H5VLiod_common.h | 3 +- src/H5VLiod_dset.c | 26 +++++++-------- src/H5VLiod_dtype.c | 12 +++---- src/H5VLiod_file.c | 14 ++++---- src/H5VLiod_group.c | 25 +++++++++------ src/H5VLiod_link.c | 51 +++++++++++++++++------------ src/H5VLiod_map.c | 22 ++++++------- src/H5VLiod_obj.c | 30 ++++++++--------- src/H5VLiod_server.h | 3 +- src/H5VLiod_util.c | 20 ++++++++---- 20 files changed, 201 insertions(+), 159 deletions(-) diff --git a/examples/h5ff_client_dset.c b/examples/h5ff_client_dset.c index 4d21e65..bd1a9ee 100644 --- a/examples/h5ff_client_dset.c +++ b/examples/h5ff_client_dset.c @@ -204,9 +204,9 @@ int main(int argc, char **argv) { MPI_Ibcast(dset_token3, token_size3, MPI_BYTE, 0, MPI_COMM_WORLD, &mpi_reqs[2]); MPI_Waitall(3, mpi_reqs, MPI_STATUS_IGNORE); - did1 = H5Oopen_by_token(dset_token1, rid1, e_stack); - did2 = H5Oopen_by_token(dset_token2, rid1, e_stack); - did3 = H5Oopen_by_token(dset_token3, rid1, e_stack); + did1 = H5Oopen_by_token(dset_token1, tid1, e_stack); + did2 = H5Oopen_by_token(dset_token2, tid1, e_stack); + did3 = H5Oopen_by_token(dset_token3, tid1, e_stack); } /* write data to datasets */ diff --git a/examples/h5ff_client_links.c b/examples/h5ff_client_links.c index 685e11b..7e1471d 100644 --- a/examples/h5ff_client_links.c +++ b/examples/h5ff_client_links.c @@ -156,12 +156,14 @@ int main(int argc, char **argv) { H5ESwait_all(e_stack, &status); + /* should succeed */ did2 = H5Dopen_ff(file_id,"/G1/G2/G3/D2", H5P_DEFAULT, rid2, H5_EVENT_STACK_NULL); assert(did2); H5Dclose_ff(did2, H5_EVENT_STACK_NULL); - did2 = H5Dopen_ff(file_id,"/G1/G2/G3/D2", H5P_DEFAULT, rid3, H5_EVENT_STACK_NULL); - assert(did3 < 0); + /* should fail */ + did2 = H5Dopen_ff(file_id,"/G1/G2/G3/D2", H5P_DEFAULT, rid3, H5_EVENT_STACK_NULL); + assert(did2 < 0); /* release container version 1. This is async. */ ret = H5RCrelease(rid2, e_stack); diff --git a/examples/h5ff_client_map.c b/examples/h5ff_client_map.c index b087b3a..9eb8c7a 100644 --- a/examples/h5ff_client_map.c +++ b/examples/h5ff_client_map.c @@ -247,9 +247,9 @@ int main(int argc, char **argv) { MPI_Ibcast(map_token3, token_size3, MPI_BYTE, 0, MPI_COMM_WORLD, &mpi_reqs[2]); MPI_Waitall(3, mpi_reqs, MPI_STATUS_IGNORE); - map1 = H5Oopen_by_token(map_token1, rid1, e_stack); - map2 = H5Oopen_by_token(map_token2, rid1, e_stack); - map3 = H5Oopen_by_token(map_token3, rid1, e_stack); + map1 = H5Oopen_by_token(map_token1, tid1, e_stack); + map2 = H5Oopen_by_token(map_token2, tid1, e_stack); + map3 = H5Oopen_by_token(map_token3, tid1, e_stack); } @@ -341,11 +341,15 @@ int main(int argc, char **argv) { } /* finish transaction 2 */ - //ret = H5TRfinish(tid2, H5P_DEFAULT, NULL, e_stack); if(my_rank == 0) { ret = H5TRabort(tid2, H5_EVENT_STACK_NULL); assert(0 == ret); } + else { + ret = H5TRfinish(tid2, H5P_DEFAULT, NULL, H5_EVENT_STACK_NULL); + if(ret < 0) + fprintf(stderr, "Transaction finish failed (aborted)\n"); + } MPI_Barrier(MPI_COMM_WORLD); diff --git a/examples/h5ff_client_multiple_cont.c b/examples/h5ff_client_multiple_cont.c index 1ba79ec..023f98c 100644 --- a/examples/h5ff_client_multiple_cont.c +++ b/examples/h5ff_client_multiple_cont.c @@ -256,12 +256,12 @@ int main(int argc, char **argv) { MPI_Ibcast(token6, token_size6, MPI_BYTE, 0, MPI_COMM_WORLD, &mpi_reqs[5]); MPI_Waitall(6, mpi_reqs, MPI_STATUS_IGNORE); - gid1 = H5Oopen_by_token(token1, rid1, e_stack); - gid2 = H5Oopen_by_token(token2, rid2, e_stack); - dtid1 = H5Oopen_by_token(token3, rid1, e_stack); - dtid2 = H5Oopen_by_token(token4, rid2, e_stack); - did1 = H5Oopen_by_token(token5, rid1, e_stack); - did2 = H5Oopen_by_token(token6, rid2, e_stack); + gid1 = H5Oopen_by_token(token1, tid1, e_stack); + gid2 = H5Oopen_by_token(token2, tid2, e_stack); + dtid1 = H5Oopen_by_token(token3, tid1, e_stack); + dtid2 = H5Oopen_by_token(token4, tid2, e_stack); + did1 = H5Oopen_by_token(token5, tid1, e_stack); + did2 = H5Oopen_by_token(token6, tid2, e_stack); /* Raw data write on D1. */ H5Dwrite_ff(did1, dtid1, sid, sid, H5P_DEFAULT, wdata1, tid1, e_stack); diff --git a/src/H5FF.c b/src/H5FF.c index 67fada0..636d25c 100644 --- a/src/H5FF.c +++ b/src/H5FF.c @@ -2902,9 +2902,9 @@ done: *------------------------------------------------------------------------- */ hid_t -H5Oopen_by_token(const void *token, hid_t rcxt_id, hid_t estack_id) +H5Oopen_by_token(const void *token, hid_t trans_id, hid_t estack_id) { - H5RC_t *rc = NULL; + H5TR_t *tr = NULL; H5VL_t *vol_plugin = NULL; /* VOL plugin pointer this event queue should use */ H5_priv_request_t *request = NULL; /* private request struct inserted in event queue */ void **req = NULL; /* pointer to plugin generate requests (Stays NULL if plugin does not support async */ @@ -2913,17 +2913,17 @@ H5Oopen_by_token(const void *token, hid_t rcxt_id, hid_t estack_id) hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) - H5TRACE3("i", "*xii", token, rcxt_id, estack_id); + H5TRACE3("i", "*xii", token, trans_id, estack_id); if(NULL == token) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no token") - /* get the RC object */ - if(NULL == (rc = (H5RC_t *)H5I_object_verify(rcxt_id, H5I_RC))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Read Context ID") + /* get the TR object */ + if(NULL == (tr = (H5TR_t *)H5I_object_verify(trans_id, H5I_TR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Transaction ID") /* get the plugin pointer */ - if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(rcxt_id))) + if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(trans_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information"); if(estack_id != H5_EVENT_STACK_NULL) { @@ -2937,7 +2937,7 @@ H5Oopen_by_token(const void *token, hid_t rcxt_id, hid_t estack_id) vol_plugin->nrefs ++; } - if(NULL == (opened_obj = H5VL_iod_obj_open_token(token, rc, &opened_type, req))) + if(NULL == (opened_obj = H5VL_iod_obj_open_token(token, tr, &opened_type, req))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to open object"); if(request && *req) { diff --git a/src/H5FFpublic.h b/src/H5FFpublic.h index 43dd4c5..d84e91a 100644 --- a/src/H5FFpublic.h +++ b/src/H5FFpublic.h @@ -155,7 +155,7 @@ H5_DLL herr_t H5Lget_val_ff(hid_t link_loc_id, const char *link_name, void *link H5_DLL hid_t H5Oopen_ff(hid_t loc_id, const char *name, hid_t lapl_id, hid_t rcxt_id); H5_DLL herr_t H5Oget_token(hid_t obj_id, void *token, size_t *token_size); -H5_DLL hid_t H5Oopen_by_token(const void *token, hid_t rcxt_id, hid_t estack_id); +H5_DLL hid_t H5Oopen_by_token(const void *token, hid_t trans_id, hid_t estack_id); H5_DLL herr_t H5Olink_ff(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t trans_id, hid_t estack_id); H5_DLL herr_t H5Oexists_by_name_ff(hid_t loc_id, const char *name, hbool_t *ret, diff --git a/src/H5VLiod.c b/src/H5VLiod.c index 8eec6f1..dc3b8e6 100644 --- a/src/H5VLiod.c +++ b/src/H5VLiod.c @@ -571,12 +571,12 @@ H5VL__iod_create_and_forward(hg_id_t op_id, H5RQ_type_t op_type, } /* Since the operation is synchronous, return FAIL if the status failed */ - if(H5ES_STATUS_FAIL == request->status) + if(H5ES_STATUS_FAIL == request->status) { ret_value = FAIL; + } request->req = H5MM_xfree(request->req); H5VL_iod_request_decr_rc(request); - } /* end else */ done: @@ -5765,7 +5765,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, void **req) +H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type, void **req) { object_token_in_t input; const uint8_t *buf_ptr = (const uint8_t *)token; @@ -5834,12 +5834,13 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, buf_ptr += space_size; } - input.coh = rc->file->remote_file.coh; + input.coh = tr->file->remote_file.coh; input.iod_id = iod_id; + input.trans_num = tr->trans_num; /* set common object parameters */ dset->common.obj_type = H5I_DATASET; - dset->common.file = rc->file; + dset->common.file = tr->file; dset->common.file->nopen_objs ++; dset->common.obj_name = NULL; @@ -5850,7 +5851,7 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_BY_TOKEN_ID, HG_OBJECT_OPEN_BY_TOKEN, (H5VL_iod_object_t *)dset, 1, 0, NULL, - (H5VL_iod_req_info_t *)rc, &input, + (H5VL_iod_req_info_t *)tr, &input, &dset->remote_dset.iod_oh, dset, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship dataset open_by_token"); @@ -5888,12 +5889,13 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, } /* set the input structure for the HG encode routine */ - input.coh = rc->file->remote_file.coh; + input.coh = tr->file->remote_file.coh; input.iod_id = iod_id; + input.trans_num = tr->trans_num; /* set common object parameters */ dtype->common.obj_type = H5I_DATATYPE; - dtype->common.file = rc->file; + dtype->common.file = tr->file; dtype->common.file->nopen_objs ++; dtype->common.obj_name = NULL; @@ -5904,7 +5906,7 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_BY_TOKEN_ID, HG_OBJECT_OPEN_BY_TOKEN, (H5VL_iod_object_t *)dtype, 1, 0, NULL, - (H5VL_iod_req_info_t *)rc, &input, + (H5VL_iod_req_info_t *)tr, &input, &dtype->remote_dtype.iod_oh, dtype, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship datatype open_by_token"); @@ -5926,12 +5928,13 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, grp->gapl_id = H5Pcopy(H5P_GROUP_ACCESS_DEFAULT); /* set the input structure for the HG encode routine */ - input.coh = rc->file->remote_file.coh; + input.coh = tr->file->remote_file.coh; input.iod_id = iod_id; + input.trans_num = tr->trans_num; /* set common object parameters */ grp->common.obj_type = H5I_GROUP; - grp->common.file = rc->file; + grp->common.file = tr->file; grp->common.file->nopen_objs ++; grp->common.obj_name = NULL; @@ -5942,7 +5945,7 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_BY_TOKEN_ID, HG_OBJECT_OPEN_BY_TOKEN, (H5VL_iod_object_t *)grp, 1, 0, NULL, - (H5VL_iod_req_info_t *)rc, &input, + (H5VL_iod_req_info_t *)tr, &input, &grp->remote_group.iod_oh, grp, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship group open_by_token"); @@ -5995,12 +5998,13 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, } /* set the input structure for the HG encode routine */ - input.coh = rc->file->remote_file.coh; + input.coh = tr->file->remote_file.coh; input.iod_id = iod_id; + input.trans_num = tr->trans_num; /* set common object parameters */ map->common.obj_type = H5I_MAP; - map->common.file = rc->file; + map->common.file = tr->file; map->common.file->nopen_objs ++; map->common.obj_name = NULL; @@ -6011,7 +6015,7 @@ H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, H5I_type_t *opened_type, if(H5VL__iod_create_and_forward(H5VL_OBJECT_OPEN_BY_TOKEN_ID, HG_OBJECT_OPEN_BY_TOKEN, (H5VL_iod_object_t *)map, 1, 0, NULL, - (H5VL_iod_req_info_t *)rc, &input, + (H5VL_iod_req_info_t *)tr, &input, &map->remote_map, map, req) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "failed to create and ship map open"); diff --git a/src/H5VLiod_analysis.c b/src/H5VLiod_analysis.c index 08c3272..82b6616 100644 --- a/src/H5VLiod_analysis.c +++ b/src/H5VLiod_analysis.c @@ -1175,7 +1175,7 @@ H5VL__iod_read_selection(iod_handle_t coh, iod_obj_id_t obj_id, FUNC_ENTER_NOAPI_NOINIT /* open the array object */ - if (iod_obj_open_read(coh, obj_id, NULL /*hints*/, &obj_oh, NULL) < 0) + if (iod_obj_open_read(coh, obj_id, rtid, NULL /*hints*/, &obj_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* read the data selection from IOD. */ diff --git a/src/H5VLiod_attr.c b/src/H5VLiod_attr.c index 56f59fb..b59affb 100644 --- a/src/H5VLiod_attr.c +++ b/src/H5VLiod_attr.c @@ -66,6 +66,7 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, scratch_pad sp; iod_checksum_t sp_cs = 0; iod_size_t array_dims[H5S_MAX_RANK], current_dims[H5S_MAX_RANK]; + hbool_t opened_locally = FALSE; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -75,6 +76,13 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, attr_name, loc_handle.wr_oh, attr_id); #endif + if(loc_handle.rd_oh.cookie == IOD_OH_UNDEFINED) { + /* Try and open the starting location */ + if (iod_obj_open_read(coh, loc_id, wtid, NULL, &loc_handle.rd_oh, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open start location"); + opened_locally = TRUE; + } + /* Open the object where the attribute needs to be created. */ if(H5VL_iod_server_open_path(coh, loc_id, loc_handle, loc_name, rtid, &obj_id, &obj_oh) < 0) @@ -94,9 +102,9 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, &array, &attr_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Attribute"); - if (iod_obj_open_read(coh, attr_id, NULL, &attr_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, attr_id, wtid, NULL, &attr_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute"); - if (iod_obj_open_write(coh, attr_id, NULL, &attr_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, attr_id, wtid, NULL, &attr_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open attribute"); /* create the metadata KV object for the attribute */ @@ -121,7 +129,7 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); /* insert object type metadata */ @@ -158,12 +166,12 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, } /* open the attribute KV in scratch pad */ - if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_write(coh, loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_write(coh, loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -178,7 +186,7 @@ H5VL_iod_server_attr_create_cb(AXE_engine_t UNUSED axe_engine, /* close parent group if it is not the location we started the traversal into */ - if(loc_handle.rd_oh.cookie != obj_oh.rd_oh.cookie) { + if(TRUE == opened_locally || loc_handle.rd_oh.cookie != obj_oh.rd_oh.cookie) { iod_obj_close(obj_oh.rd_oh, NULL, NULL); } @@ -284,12 +292,12 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[1], rtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_read(coh, loc_attrkv_id, rtid, NULL /*hints*/, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -310,9 +318,9 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, iod_obj_close(attr_kv_oh, NULL, NULL); /* open the attribute */ - if (iod_obj_open_read(coh, attr_id, NULL /*hints*/, &attr_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, attr_id, rtid, NULL /*hints*/, &attr_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); - if (iod_obj_open_write(coh, attr_id, NULL /*hints*/, &attr_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, attr_id, rtid, NULL /*hints*/, &attr_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* get scratch pad of the attribute */ @@ -326,7 +334,7 @@ H5VL_iod_server_attr_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATATYPE, @@ -420,7 +428,7 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, /* open the attribute if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -438,7 +446,7 @@ H5VL_iod_server_attr_read_cb(AXE_engine_t UNUSED axe_engine, /* MSC - Not needed if dataspace is available */ #if 0 /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, mdkv_id, rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, @@ -563,7 +571,7 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, //hid_t type_id = input->type_id; /* datatype ID of data */ hid_t space_id = input->space_id; /* dataspace of attribute */ iod_trans_id_t wtid = input->trans_num; - //iod_trans_id_t rtid = input->rcxt_num; + iod_trans_id_t rtid = input->rcxt_num; uint32_t cs_scope = input->cs_scope; hg_bulk_block_t bulk_block_handle; /* HG block handle */ hg_bulk_request_t bulk_request; /* HG request */ @@ -583,7 +591,7 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, /* open the attribute if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -626,7 +634,7 @@ H5VL_iod_server_attr_write_cb(AXE_engine_t UNUSED axe_engine, /* MSC - Not needed if dataspace is available */ #if 0 /* open the metadata scratch pad of the attribute */ - if (iod_obj_open_read(coh, mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, mdkv_id, wtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_DATASPACE, H5VL_IOD_KEY_OBJ_DATASPACE, @@ -771,12 +779,12 @@ H5VL_iod_server_attr_exists_cb(AXE_engine_t UNUSED axe_engine, } /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[1], rtid, NULL, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attr_kv_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -880,16 +888,16 @@ H5VL_iod_server_attr_rename_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -1011,16 +1019,16 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "Object has no attributes"); /* open the attribute KV in scratch pad */ - if (iod_obj_open_read(coh, sp[1], NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[1], NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[1], wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->loc_attrkv_id, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, input->loc_attrkv_id, wtid, NULL /*hints*/, &attr_kv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_ATTR, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -1040,7 +1048,7 @@ H5VL_iod_server_attr_remove_cb(AXE_engine_t UNUSED axe_engine, /* remove metadata KV of attribute */ /* open the attribute */ - if (iod_obj_open_read(coh, attr_id, NULL /*hints*/, &attr_oh, NULL) < 0) + if (iod_obj_open_read(coh, attr_id, wtid, NULL /*hints*/, &attr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* get scratch pad of the attribute */ diff --git a/src/H5VLiod_client.h b/src/H5VLiod_client.h index 2b7c446..c38d53b 100644 --- a/src/H5VLiod_client.h +++ b/src/H5VLiod_client.h @@ -395,7 +395,7 @@ H5_DLL herr_t H5VL_iod_map_delete(void *map, hid_t key_mem_type_id, const void * hid_t trans_id, void **req); H5_DLL herr_t H5VL_iod_map_close(void *map, void **req); -H5_DLL void * H5VL_iod_obj_open_token(const void *token, H5RC_t *rc, +H5_DLL void * H5VL_iod_obj_open_token(const void *token, H5TR_t *tr, H5I_type_t *opened_type, void **req); /* private routines for RC */ diff --git a/src/H5VLiod_common.h b/src/H5VLiod_common.h index a5a6b6a..ca61607 100644 --- a/src/H5VLiod_common.h +++ b/src/H5VLiod_common.h @@ -551,7 +551,8 @@ MERCURY_GEN_PROC(object_token_in_t, ((axe_t)(axe_info)) ((uint32_t)(cs_scope)) ((iod_handle_t)(coh)) - ((iod_obj_id_t)(iod_id))) + ((iod_obj_id_t)(iod_id)) + ((uint64_t)(trans_num))) MERCURY_GEN_PROC(object_op_in_t, ((axe_t)(axe_info)) ((uint32_t)(cs_scope)) diff --git a/src/H5VLiod_dset.c b/src/H5VLiod_dset.c index 6ce5c72..9386180 100644 --- a/src/H5VLiod_dset.c +++ b/src/H5VLiod_dset.c @@ -107,7 +107,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the dataset needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -147,9 +147,9 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Array object"); } - if (iod_obj_open_write(coh, dset_id, NULL, &dset_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, dset_id, wtid, NULL, &dset_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Dataset for Write"); - if (iod_obj_open_read(coh, dset_id, NULL, &dset_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, dset_id, wtid, NULL, &dset_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Dataset for Read"); /* create the attribute KV object for the dataset */ @@ -180,7 +180,7 @@ H5VL_iod_server_dset_create_cb(AXE_engine_t UNUSED axe_engine, } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); if(H5P_DEFAULT == input->dcpl_id) @@ -306,7 +306,7 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, dset_id, NULL, &dset_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, dset_id, rtid, NULL, &dset_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current dset"); /* get scratch pad of the dataset */ @@ -320,7 +320,7 @@ H5VL_iod_server_dset_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, @@ -418,7 +418,7 @@ H5VL_iod_server_dset_read_cb(AXE_engine_t UNUSED axe_engine, /* open the dataset if we don't have the handle yet */ if(iod_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -593,7 +593,7 @@ H5VL_iod_server_dset_get_vl_size_cb(AXE_engine_t UNUSED axe_engine, /* open the dataset if we don't have the handle yet */ if(iod_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, rtid, NULL /*hints*/, &iod_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -811,7 +811,7 @@ H5VL_iod_server_dset_write_cb(AXE_engine_t UNUSED axe_engine, /* open the dataset if we don't have the handle yet */ if(iod_oh.wr_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -977,7 +977,7 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, /* open the dataset if we don't have the handle yet */ if(iod_oh.wr_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -993,7 +993,7 @@ H5VL_iod_server_dset_set_extent_cb(AXE_engine_t UNUSED axe_engine, iod_handle_t mdkv_oh; /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, mdkv_id, NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); /* get the stored dataset dataspace */ @@ -1463,7 +1463,7 @@ H5VL__iod_server_vl_data_io_cb(void UNUSED *elem, hid_t type_id, unsigned ndims, HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "Failed to create BLOB object"); } /* Open blob object */ - if (iod_obj_open_write(coh, blob_id, NULL, &blob_oh, NULL) < 0) + if (iod_obj_open_write(coh, blob_id, tid, NULL, &blob_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Datatype"); seq_len = *((size_t *)(udata->buf_ptr)); @@ -1554,7 +1554,7 @@ H5VL__iod_server_vl_data_io_cb(void UNUSED *elem, hid_t type_id, unsigned ndims, udata->buf_ptr += sizeof(size_t); /* Open blob object */ - if (iod_obj_open_write(coh, blob_id, NULL, &blob_oh, NULL) < 0) + if (iod_obj_open_write(coh, blob_id, tid, NULL, &blob_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Datatype"); /* create memory descriptor for reading */ diff --git a/src/H5VLiod_dtype.c b/src/H5VLiod_dtype.c index 15eeca7..a8c5089 100644 --- a/src/H5VLiod_dtype.c +++ b/src/H5VLiod_dtype.c @@ -78,7 +78,7 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the datatype needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -89,9 +89,9 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_BLOB, NULL, NULL, &dtype_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create BLOB"); - if (iod_obj_open_read(coh, dtype_id, NULL, &dtype_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, dtype_id, wtid, NULL, &dtype_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open BLOB"); - if (iod_obj_open_write(coh, dtype_id, NULL, &dtype_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, dtype_id, wtid, NULL, &dtype_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open BLOB"); /* create the metadata KV object for the datatype */ @@ -122,7 +122,7 @@ H5VL_iod_server_dtype_commit_cb(AXE_engine_t UNUSED axe_engine, } /* Store Metadata in scratch pad */ - if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open metadata KV object"); /* determine the buffer size needed to store the encoded type of the datatype */ @@ -293,7 +293,7 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, dtype_id, NULL, &dtype_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, dtype_id, rtid, NULL, &dtype_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current datatype"); /* get scratch pad of the datatype */ @@ -307,7 +307,7 @@ H5VL_iod_server_dtype_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, H5VL_IOD_KEY_OBJ_CPL, diff --git a/src/H5VLiod_file.c b/src/H5VLiod_file.c index d1c71b7..18348b6 100644 --- a/src/H5VLiod_file.c +++ b/src/H5VLiod_file.c @@ -89,11 +89,11 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, if(0 == root_ret || -EEXIST == root_ret) { //fprintf(stderr, "created Root group %"PRIx64"\n", root_id); /* root group has been created, open it */ - if ((ret = iod_obj_open_write(coh, root_id, NULL, &root_oh.wr_oh, NULL)) < 0) { + if ((ret = iod_obj_open_write(coh, root_id, first_tid, NULL, &root_oh.wr_oh, NULL)) < 0) { fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open root group for write"); } - if ((ret = iod_obj_open_read(coh, root_id, NULL, &root_oh.rd_oh, NULL)) < 0) { + if ((ret = iod_obj_open_read(coh, root_id, first_tid, NULL, &root_oh.rd_oh, NULL)) < 0) { fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open root group for read"); } @@ -146,7 +146,7 @@ H5VL_iod_server_file_create_cb(AXE_engine_t UNUSED axe_engine, } /* Store Metadata in scratch pad */ - if (iod_obj_open_write(coh, input->mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, input->mdkv_id, first_tid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open metadata KV"); /* store metadata */ @@ -284,11 +284,11 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_CANTSET, FAIL, "can't start transaction"); /* open the root group */ - if ((ret = iod_obj_open_read(coh, ROOT_ID, NULL /*hints*/, &root_oh.rd_oh, NULL)) < 0) { + if ((ret = iod_obj_open_read(coh, ROOT_ID, rtid, NULL /*hints*/, &root_oh.rd_oh, NULL)) < 0) { fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object for read"); } - if ((ret = iod_obj_open_write(coh, ROOT_ID, NULL /*hints*/, &root_oh.wr_oh, NULL)) < 0) { + if ((ret = iod_obj_open_write(coh, ROOT_ID, rtid, NULL /*hints*/, &root_oh.wr_oh, NULL)) < 0) { fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open root object for write"); } @@ -303,7 +303,7 @@ H5VL_iod_server_file_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); /* retrieve all metadata from scratch pad */ @@ -456,7 +456,7 @@ H5VL_iod_server_file_close_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, sp[0], NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open metadata KV"); /* insert current indexes in the metadata KV object */ diff --git a/src/H5VLiod_group.c b/src/H5VLiod_group.c index 3e4c223..392d963 100644 --- a/src/H5VLiod_group.c +++ b/src/H5VLiod_group.c @@ -63,6 +63,7 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, char *last_comp = NULL; /* the name of the group obtained from traversal function */ hid_t gcpl_id; scratch_pad sp; + iod_ret_t ret; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -74,21 +75,27 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the group needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); - fprintf(stderr, "Creating Group ID %"PRIx64") ", grp_id); + fprintf(stderr, "Creating Group ID %"PRIx64" (CV %"PRIu64", TR %"PRIu64") ", + grp_id, rtid, wtid); fprintf(stderr, "at (OH %"PRIu64" ID %"PRIx64")\n", cur_oh.wr_oh, cur_id); /* create the group */ if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &grp_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Group"); - if (iod_obj_open_read(coh, grp_id, NULL, &grp_oh.rd_oh, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group"); - if (iod_obj_open_write(coh, grp_id, NULL, &grp_oh.wr_oh, NULL) < 0) - HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group"); + if((ret = iod_obj_open_read(coh, grp_id, wtid, NULL, &grp_oh.rd_oh, NULL)) < 0) { + fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group for read"); + } + + if((ret = iod_obj_open_write(coh, grp_id, wtid, NULL, &grp_oh.wr_oh, NULL)) < 0) { + fprintf(stderr, "%d (%s).\n", ret, strerror(-ret)); + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Group for write"); + } /* create the metadata KV object for the group */ if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &mdkv_id, NULL) < 0) @@ -119,7 +126,7 @@ H5VL_iod_server_group_create_cb(AXE_engine_t UNUSED axe_engine, /* store metadata */ /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); if(H5P_DEFAULT == input->gcpl_id) @@ -237,7 +244,7 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object"); /* open a write handle on the ID. */ - if(iod_obj_open_write(coh, grp_id, NULL, &grp_oh.wr_oh, NULL) < 0) + if(iod_obj_open_write(coh, grp_id, rtid, NULL, &grp_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* get scratch pad of group */ @@ -251,7 +258,7 @@ H5VL_iod_server_group_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, diff --git a/src/H5VLiod_link.c b/src/H5VLiod_link.c index a2c7faa..4ffe3f6 100644 --- a/src/H5VLiod_link.c +++ b/src/H5VLiod_link.c @@ -68,7 +68,7 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, to be created from. The traversal will fail if an intermediate group does not exist. */ if(H5VL_iod_server_traverse(coh, input->loc_id, input->loc_oh, input->loc_name, - rtid, FALSE, &src_last_comp, &src_id, &src_oh) < 0) + wtid, rtid, FALSE, &src_last_comp, &src_id, &src_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); #if H5VL_IOD_DEBUG @@ -80,7 +80,15 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, iod_checksum_t sp_cs = 0; iod_handles_t mdkv_oh; uint64_t link_count = 0; - + hbool_t opened_locally = FALSE; + + if(input->target_loc_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { + /* Try and open the starting location */ + if (iod_obj_open_read(coh, input->target_loc_id, wtid, NULL, + &input->target_loc_oh.rd_oh, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open start location"); + opened_locally = TRUE; + } /* Traverse Path and open the target object */ if(H5VL_iod_server_open_path(coh, input->target_loc_id, input->target_loc_oh, input->target_name, rtid, &target_id, &target_oh) < 0) @@ -103,16 +111,16 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->target_mdkv_id, NULL, &mdkv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, input->target_mdkv_id, NULL, &mdkv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, input->target_mdkv_id, rtid, NULL, &mdkv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); } @@ -135,7 +143,8 @@ H5VL_iod_server_link_create_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); /* close the target location */ - if(input->target_loc_oh.rd_oh.cookie != target_oh.rd_oh.cookie) { + if(TRUE == opened_locally || + input->target_loc_oh.rd_oh.cookie != target_oh.rd_oh.cookie) { if(iod_obj_close(target_oh.rd_oh, NULL, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close object"); } @@ -229,16 +238,16 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, to be moved/copied from. The traversal will fail if an intermediate group does not exist. */ if(H5VL_iod_server_traverse(coh, input->src_loc_id, input->src_loc_oh, - input->src_loc_name, - rtid, FALSE, &src_last_comp, &src_id, &src_oh) < 0) + input->src_loc_name, wtid, rtid, FALSE, + &src_last_comp, &src_id, &src_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /* the traversal will retrieve the location where the link needs to be moved/copied to. The traversal will fail if an intermediate group does not exist. */ if(H5VL_iod_server_traverse(coh, input->dst_loc_id, input->dst_loc_oh, - input->dst_loc_name, - rtid, FALSE, &dst_last_comp, &dst_id, &dst_oh) < 0) + input->dst_loc_name, wtid, rtid, FALSE, + &dst_last_comp, &dst_id, &dst_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); /* get the link value */ @@ -286,7 +295,7 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, uint64_t link_count = 0; /* open the current group */ - if (iod_obj_open_read(coh, iod_link.u.iod_id, NULL, &target_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_link.u.iod_id, rtid, NULL, &target_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* get scratch pad */ @@ -299,9 +308,9 @@ H5VL_iod_server_link_move_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, @@ -409,7 +418,7 @@ H5VL_iod_server_link_exists_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be checked */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) { ret = FALSE; HGOTO_DONE(SUCCEED); @@ -487,7 +496,7 @@ H5VL_iod_server_link_get_info_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be checked */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -592,7 +601,7 @@ H5VL_iod_server_link_get_val_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be checked */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -706,7 +715,7 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the link needs to be removed. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, rtid, + if(H5VL_iod_server_traverse(coh, loc_id, loc_oh, loc_name, wtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -737,7 +746,7 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, obj_id = iod_link.u.iod_id; /* open the current group */ - if (iod_obj_open_read(coh, obj_id, NULL, &obj_oh, NULL) < 0) + if (iod_obj_open_read(coh, obj_id, rtid, NULL, &obj_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* get scratch pad */ @@ -751,9 +760,9 @@ H5VL_iod_server_link_remove_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); - if (iod_obj_open_write(coh, sp[0], NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh.rd_oh, rtid, H5VL_IOD_LINK_COUNT, diff --git a/src/H5VLiod_map.c b/src/H5VLiod_map.c index 8ad95bd..753d676 100644 --- a/src/H5VLiod_map.c +++ b/src/H5VLiod_map.c @@ -80,7 +80,7 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, /* the traversal will retrieve the location where the map needs to be created. The traversal will fail if an intermediate group does not exist. */ - if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, rtid, FALSE, + if(H5VL_iod_server_traverse(coh, loc_id, loc_handle, name, wtid, rtid, FALSE, &last_comp, &cur_id, &cur_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't traverse path"); @@ -91,9 +91,9 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, if(iod_obj_create(coh, wtid, NULL, IOD_OBJ_KV, NULL, NULL, &map_id, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create Map"); - if (iod_obj_open_read(coh, map_id, NULL, &map_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, map_id, wtid, NULL, &map_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Map"); - if (iod_obj_open_write(coh, map_id, NULL, &map_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, map_id, wtid, NULL, &map_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open Map"); /* create the metadata KV object for the map */ @@ -124,7 +124,7 @@ H5VL_iod_server_map_create_cb(AXE_engine_t UNUSED axe_engine, } /* Open Metadata KV object for write */ - if (iod_obj_open_write(coh, mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, mdkv_id, wtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't create scratch pad"); if(H5P_DEFAULT == input->mcpl_id) @@ -251,7 +251,7 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object"); /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, map_id, NULL, &map_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, map_id, rtid, NULL, &map_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current map"); /* get scratch pad of map */ @@ -265,7 +265,7 @@ H5VL_iod_server_map_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open scratch pad"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_PLIST, @@ -370,7 +370,7 @@ H5VL_iod_server_map_set_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, wtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -558,7 +558,7 @@ H5VL_iod_server_map_get_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -737,7 +737,7 @@ H5VL_iod_server_map_get_count_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -819,7 +819,7 @@ H5VL_iod_server_map_exists_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_read(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } @@ -909,7 +909,7 @@ H5VL_iod_server_map_delete_cb(AXE_engine_t UNUSED axe_engine, /* open the map if we don't have the handle yet */ if(iod_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_write(coh, iod_id, NULL /*hints*/, &iod_oh, NULL) < 0) + if (iod_obj_open_write(coh, iod_id, rtid, NULL /*hints*/, &iod_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); opened_locally = TRUE; } diff --git a/src/H5VLiod_obj.c b/src/H5VLiod_obj.c index c33e1b9..24d54d3 100644 --- a/src/H5VLiod_obj.c +++ b/src/H5VLiod_obj.c @@ -48,7 +48,7 @@ H5VL_iod_server_object_open_by_token_cb(AXE_engine_t UNUSED axe_engine, object_token_in_t *input = (object_token_in_t *)op_data->input; iod_handle_t coh = input->coh; /* the container handle */ iod_obj_id_t obj_id = input->iod_id; /* The ID of the object */ - //iod_trans_id_t rtid = input->rcxt_num; + iod_trans_id_t tid = input->trans_num; //uint32_t cs_scope = input->cs_scope; iod_handles_t obj_oh; /* The handle for object */ herr_t ret_value = SUCCEED; @@ -59,9 +59,9 @@ H5VL_iod_server_object_open_by_token_cb(AXE_engine_t UNUSED axe_engine, fprintf(stderr, "Start Object Open by token = %"PRIx64"\n", obj_id); #endif - if (iod_obj_open_read(coh, obj_id, NULL /*hints*/, &obj_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, obj_id, tid, NULL /*hints*/, &obj_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); - if (iod_obj_open_write(coh, obj_id, NULL /*hints*/, &obj_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, obj_id, tid, NULL /*hints*/, &obj_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); #if H5VL_IOD_DEBUG @@ -128,7 +128,7 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, rtid, &obj_id, &obj_oh) < 0) HGOTO_ERROR2(H5E_SYM, H5E_NOSPACE, FAIL, "can't open object"); - if (iod_obj_open_write(coh, obj_id, NULL, &obj_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, obj_id, rtid, NULL, &obj_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); if(obj_id != input->loc_id) { @@ -143,12 +143,12 @@ H5VL_iod_server_object_open_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } @@ -357,7 +357,7 @@ H5VL_iod_server_object_copy_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); if(H5VL_iod_get_metadata(mdkv_oh, rtid, H5VL_IOD_OBJECT_TYPE, H5VL_IOD_KEY_OBJ_TYPE, @@ -605,18 +605,18 @@ H5VL_iod_server_object_get_info_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); /* open the attribute KV */ - if (iod_obj_open_read(coh, sp[1], NULL, &attrkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[1], rtid, NULL, &attrkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open ATTRKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); /* open the attribute KV */ - if (iod_obj_open_read(coh, input->loc_attrkv_id, NULL, &attrkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_attrkv_id, rtid, NULL, &attrkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } @@ -743,12 +743,12 @@ H5VL_iod_server_object_set_comment_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata scratch pad */ - if (iod_obj_open_write(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_write(coh, input->loc_mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_write(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } @@ -851,12 +851,12 @@ H5VL_iod_server_object_get_comment_cb(AXE_engine_t UNUSED axe_engine, } /* open the metadata KV */ - if (iod_obj_open_read(coh, sp[0], NULL /*hints*/, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, sp[0], rtid, NULL /*hints*/, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } else { /* open the metadata KV */ - if (iod_obj_open_read(coh, input->loc_mdkv_id, NULL, &mdkv_oh, NULL) < 0) + if (iod_obj_open_read(coh, input->loc_mdkv_id, rtid, NULL, &mdkv_oh, NULL) < 0) HGOTO_ERROR2(H5E_FILE, H5E_CANTINIT, FAIL, "can't open MDKV"); } diff --git a/src/H5VLiod_server.h b/src/H5VLiod_server.h index 6e28c9a..61bacab 100644 --- a/src/H5VLiod_server.h +++ b/src/H5VLiod_server.h @@ -383,7 +383,8 @@ H5_DLL void H5VL_iod_server_trans_abort_cb(AXE_engine_t axe_engine, /* Helper routines used several times in different places */ H5_DLL herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, - const char *path, iod_trans_id_t tid, hbool_t create_interm_grps, + const char *path, iod_trans_id_t wtid, iod_trans_id_t rtid, + hbool_t create_interm_grps, char **last_comp, iod_obj_id_t *iod_id, iod_handles_t *iod_oh); H5_DLL herr_t H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, const char *path, diff --git a/src/H5VLiod_util.c b/src/H5VLiod_util.c index fae5030..a02d83c 100644 --- a/src/H5VLiod_util.c +++ b/src/H5VLiod_util.c @@ -49,7 +49,8 @@ */ herr_t H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t loc_handle, - const char *path, iod_trans_id_t rtid, hbool_t create_interm_grps, + const char *path, iod_trans_id_t wtid, iod_trans_id_t rtid, + hbool_t create_interm_grps, /* out */char **last_comp, /* out */iod_obj_id_t *iod_id, /* out */iod_handles_t *iod_oh) { @@ -73,7 +74,7 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo /* open the current group */ if(cur_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { - if (iod_obj_open_read(coh, loc_id, NULL /*hints*/, &cur_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, loc_id, wtid, NULL /*hints*/, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); } @@ -142,7 +143,7 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo } /* open the current group */ - if (iod_obj_open_read(coh, cur_id, NULL, &cur_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); /* Advance to next component in string */ @@ -159,7 +160,7 @@ H5VL_iod_server_traverse(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t lo if(cur_id != loc_id || loc_handle.wr_oh.cookie == IOD_OH_UNDEFINED) { /* open a write handle on the ID. */ - if (iod_obj_open_write(coh, cur_id, NULL, &cur_oh.wr_oh, NULL) < 0) + if (iod_obj_open_write(coh, cur_id, wtid, NULL, &cur_oh.wr_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current group"); } @@ -207,7 +208,7 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l if(cur_oh.rd_oh.cookie == IOD_OH_UNDEFINED) { /* open the current group */ - if (iod_obj_open_read(coh, loc_id, NULL, &cur_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, loc_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open start location"); } @@ -241,8 +242,13 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l /* lookup next object in the current group */ if(H5VL_iod_get_metadata(cur_oh.rd_oh, rtid, H5VL_IOD_LINK, - comp, NULL, NULL, &value) < 0) + comp, NULL, NULL, &value) < 0) { + /* Close previous handle unless it is the original one */ + if(loc_handle.rd_oh.cookie != prev_oh.cookie && + iod_obj_close(prev_oh, NULL, NULL) < 0) + HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); HGOTO_ERROR2(H5E_SYM, H5E_CANTGET, FAIL, "failed to retrieve link value"); + } /* if this a soft link, traverse the link value if the ID is undefined */ if(H5L_TYPE_SOFT == value.link_type) { @@ -266,7 +272,7 @@ H5VL_iod_server_open_path(iod_handle_t coh, iod_obj_id_t loc_id, iod_handles_t l HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't close current object handle"); /* open the current group */ - if (iod_obj_open_read(coh, cur_id, NULL, &cur_oh.rd_oh, NULL) < 0) + if (iod_obj_open_read(coh, cur_id, rtid, NULL, &cur_oh.rd_oh, NULL) < 0) HGOTO_ERROR2(H5E_SYM, H5E_CANTINIT, FAIL, "can't open current object"); /* Advance to next component in string */ -- cgit v0.12