Skip to content

Commit

Permalink
Re-enable collective metadata reads after disabling for chunk lookup (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jhendersonHDF authored Nov 12, 2021
1 parent 8c2e79f commit 7091057
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
7 changes: 7 additions & 0 deletions release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ Bug Fixes since HDF5-1.12.1 release
===================================
Library
-------
- Fixed an issue with collective metadata reads being permanently disabled
after a dataset chunk lookup operation. This would usually cause a
mismatched MPI_Bcast and MPI_ERR_TRUNCATE issue in the library for
simple cases of H5Dcreate() -> H5Dwrite() -> H5Dcreate().

(JTH - 2021/11/08, HDFFV-11090)

- Fixed a segmentation fault

A segmentation fault occurred with a Mathworks corrupted file.
Expand Down
28 changes: 21 additions & 7 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -3149,11 +3149,14 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
herr_t
H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata)
{
H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
unsigned idx = 0; /* Index of chunk in cache, if present */
hbool_t found = FALSE; /* In cache? */
herr_t ret_value = SUCCEED; /* Return value */
H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
unsigned idx = 0; /* Index of chunk in cache, if present */
hbool_t found = FALSE; /* In cache? */
#ifdef H5_HAVE_PARALLEL
hbool_t reenable_coll_md_reads = FALSE;
#endif
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_PACKAGE

Expand Down Expand Up @@ -3224,8 +3227,13 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
* highly unlikely that users would read the same chunks from all
* processes.
*/
if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
H5CX_set_coll_metadata_read(FALSE);
if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
hbool_t do_coll_md_reads = H5CX_get_coll_metadata_read();
if (do_coll_md_reads) {
H5CX_set_coll_metadata_read(FALSE);
reenable_coll_md_reads = TRUE;
}
}
#endif /* H5_HAVE_PARALLEL */

/* Go get the chunk information */
Expand Down Expand Up @@ -3268,6 +3276,12 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
} /* end else */

done:
#ifdef H5_HAVE_PARALLEL
/* Re-enable collective metadata reads if we disabled them */
if (reenable_coll_md_reads)
H5CX_set_coll_metadata_read(TRUE);
#endif /* H5_HAVE_PARALLEL */

FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_lookup() */

Expand Down

0 comments on commit 7091057

Please sign in to comment.