summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2016-12-07 21:56:51 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2016-12-07 21:56:51 (GMT)
commit5eb7d11b53c783b104650420cfa2ba4ea1db6144 (patch)
tree3afe48c89e59ff3277535fa03e067366da81c70f
parent340b4658a42567dfd5595721de349e7d5a55ed3a (diff)
downloadhdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.zip
hdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.tar.gz
hdf5-5eb7d11b53c783b104650420cfa2ba4ea1db6144.tar.bz2
Fix memory leak in H5VL_daosm_dataset_write, bug in
H5VL_daosm_file_open, bug in h5dsm_dset_wpartial, and add separate transactions in h5dsm_dset_wpartial.
-rw-r--r--examples/h5dsm_dset_wpartial.c16
-rw-r--r--src/H5VLdaosm.c27
2 files changed, 30 insertions, 13 deletions
diff --git a/examples/h5dsm_dset_wpartial.c b/examples/h5dsm_dset_wpartial.c
index 22b8178..9558fb3 100644
--- a/examples/h5dsm_dset_wpartial.c
+++ b/examples/h5dsm_dset_wpartial.c
@@ -11,7 +11,7 @@ int main(int argc, char *argv[]) {
uint64_t trans_num;
int buf[4][6];
int rank, mpi_size;
- char *file_sel_str[2] = {"XXX...", "...XXX");
+ char *file_sel_str[2] = {"XXX...", "...XXX"};
int i, j;
(void)MPI_Init(&argc, &argv);
@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) {
if(rank == 1)
MPI_Barrier(MPI_COMM_WORLD);
- printf("Rank %d:\n");
+ printf("---------------Rank %d---------------\n", rank);
printf("Selecting elements denoted with X\n");
printf("Memory File\n");
printf("...... %s\n", file_sel_str[rank]);
@@ -96,14 +96,24 @@ int main(int argc, char *argv[]) {
if(H5Sselect_hyperslab(mem_space, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
ERROR;
+ if(rank == 1) {
+ MPI_Barrier(MPI_COMM_WORLD);
+ if(H5TRclose(trans) < 0)
+ ERROR;
+ if((trans = H5TRcreate(file, trans_num + 2)) < 0)
+ ERROR;
+ }
+
/* Write data */
if(H5Dwrite_ff(dset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf, trans) < 0)
ERROR;
- /* Commit transaction */
if(H5TRcommit(trans) < 0)
ERROR;
+ if(rank == 0)
+ MPI_Barrier(MPI_COMM_WORLD);
+
/* Close */
if(H5Dclose_ff(dset, -1) < 0)
ERROR;
diff --git a/src/H5VLdaosm.c b/src/H5VLdaosm.c
index eb2679c..8ee4ab7 100644
--- a/src/H5VLdaosm.c
+++ b/src/H5VLdaosm.c
@@ -898,6 +898,12 @@ H5VL_daosm_file_open(const char *name, unsigned flags, hid_t fapl_id,
/* Read from the HCE */
epoch--;
+ /* Generate roor group ID */
+ root_grp_oid.lo = 1; //DSMINC
+ root_grp_oid.mid = 0; //DSMINC
+ root_grp_oid.hi = 0; //DSMINC
+ daos_obj_id_generate(&root_grp_oid, DAOS_OC_TINY_RW); //DSMINC
+
/* Bcast global handles if there are other processes */
if(file->num_procs > 1) {
/* Calculate sizes of global pool and container handles */
@@ -915,9 +921,9 @@ H5VL_daosm_file_open(const char *name, unsigned flags, hid_t fapl_id,
bcast_buf_64[1] = (uint64_t)glob.iov_buf_len;
/* Add root group oid to bcast_buf_64 */
- bcast_buf_64[2] = file->root_grp->oid.lo;
- bcast_buf_64[3] = file->root_grp->oid.mid;
- bcast_buf_64[4] = file->root_grp->oid.hi;
+ bcast_buf_64[2] = root_grp_oid.lo;
+ bcast_buf_64[3] = root_grp_oid.mid;
+ bcast_buf_64[4] = root_grp_oid.hi;
/* Add epoch to bcast_buf_64 */
HDassert(sizeof(bcast_buf_64[5]) == sizeof(epoch));
@@ -963,9 +969,9 @@ H5VL_daosm_file_open(const char *name, unsigned flags, hid_t fapl_id,
} /* end if */
/* Retrieve root group oid from bcast_buf_64 */
- file->root_grp->oid.lo = bcast_buf_64[2];
- file->root_grp->oid.mid = bcast_buf_64[3];
- file->root_grp->oid.hi = bcast_buf_64[4];
+ root_grp_oid.lo = bcast_buf_64[2];
+ root_grp_oid.mid = bcast_buf_64[3];
+ root_grp_oid.hi = bcast_buf_64[4];
/* Retrieve epoch from bcast_buf_64 */
HDassert(sizeof(bcast_buf_64[5]) == sizeof(epoch));
@@ -1003,10 +1009,6 @@ H5VL_daosm_file_open(const char *name, unsigned flags, hid_t fapl_id,
file->max_oid_dirty = FALSE; //DSMINC
/* Open root group */
- root_grp_oid.lo = 1; //DSMINC
- root_grp_oid.mid = 0; //DSMINC
- root_grp_oid.hi = 0; //DSMINC
- daos_obj_id_generate(&root_grp_oid, DAOS_OC_TINY_RW); //DSMINC
if(NULL == (file->root_grp = (H5VL_daosm_group_t *)H5VL_daosm_group_open_helper(file, root_grp_oid, H5P_GROUP_ACCESS_DEFAULT, dxpl_id, req, epoch)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't open root group")
@@ -2376,6 +2378,11 @@ H5VL_daosm_dataset_write(void *_dset, hid_t H5_ATTR_UNUSED mem_type_id, hid_t H5
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data to dataset: %d", ret)
done:
+ if(recxs != &recx)
+ H5MM_free(recxs);
+ if(sg_iovs != &sg_iov)
+ H5MM_free(sg_iovs);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_daosm_dataset_write() */