summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-08-22 03:09:04 (GMT)
committerGitHub <noreply@github.com>2023-08-22 03:09:04 (GMT)
commit5df18802d01d993323aa6153e4fa67b9e7d65398 (patch)
tree488208dc9e5d12c446a6de0a33097256e0192c77 /src
parentffde055be2995ea62ee5ccbcb9c3a838b1fed229 (diff)
downloadhdf5-5df18802d01d993323aa6153e4fa67b9e7d65398.zip
hdf5-5df18802d01d993323aa6153e4fa67b9e7d65398.tar.gz
hdf5-5df18802d01d993323aa6153e4fa67b9e7d65398.tar.bz2
Fix serial to parallel chunked dataset file space allocation bug (#3394)
Diffstat (limited to 'src')
-rw-r--r--src/H5Dint.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index e6a709e..a547a72 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1664,12 +1664,13 @@ done:
static herr_t
H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
{
- H5P_genplist_t *plist; /* Property list */
- H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */
- unsigned alloc_time_state; /* Allocation time state */
- htri_t msg_exists; /* Whether a particular type of message exists */
- hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t *plist; /* Property list */
+ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value info */
+ unsigned alloc_time_state; /* Allocation time state */
+ htri_t msg_exists; /* Whether a particular type of message exists */
+ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
+ hbool_t must_init_storage = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
@@ -1812,12 +1813,24 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
* Make sure all storage is properly initialized.
* This is important only for parallel I/O where the space must
* be fully allocated before I/O can happen.
+ *
+ * Storage will be initialized here if either the VFD being used
+ * has set the H5FD_FEAT_ALLOCATE_EARLY flag to indicate that it
+ * wishes to force early space allocation OR a parallel VFD is
+ * being used and the dataset in question doesn't have any filters
+ * applied to it. If filters are applied to the dataset, collective
+ * I/O will be required when writing to the dataset, so we don't
+ * need to initialize storage here, as the collective I/O process
+ * will coordinate that.
*/
- if ((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) &&
- !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) &&
- H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY))
- if (H5D__alloc_storage(dataset, H5D_ALLOC_OPEN, FALSE, NULL) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage");
+ must_init_storage = (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) &&
+ !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage);
+ must_init_storage = must_init_storage && (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY) ||
+ (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) &&
+ dataset->shared->dcpl_cache.pline.nused == 0));
+
+ if (must_init_storage && (H5D__alloc_storage(dataset, H5D_ALLOC_OPEN, FALSE, NULL) < 0))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage");
done:
if (ret_value < 0) {