summaryrefslogtreecommitdiffstats
path: root/src/H5FDioc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FDioc.c')
-rw-r--r--src/H5FDioc.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/H5FDioc.c b/src/H5FDioc.c
index b514448..b00fb51 100644
--- a/src/H5FDioc.c
+++ b/src/H5FDioc.c
@@ -740,9 +740,9 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t ioc_fapl_id, haddr_t maxa
const H5FD_ioc_config_t *fapl_ptr = NULL; /* Driver-specific property list */
H5FD_class_t * driver = NULL; /* VFD for file */
H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */
- H5P_genplist_t * plist_ptr = NULL;
- H5FD_t * ret_value = NULL;
- int mpi_enabled = 0;
+ H5P_genplist_t * plist_ptr = NULL;
+ H5FD_t * ret_value = NULL;
+ int l_error = 0, g_error = 0, mpi_enabled = 0;
FUNC_ENTER_STATIC
H5FD_IOC_LOG_CALL(FUNC);
@@ -833,10 +833,20 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t ioc_fapl_id, haddr_t maxa
* as an alternative to opening a new subfiling file, e.g. nnn_0_of_N.h5
*/
file_ptr->inode = inode_id = sb.st_ino;
- // file_ptr->hdf_fd_dup = HDdup(hdf_file->fd);
}
- else
- goto done;
+ else {
+ /* The two-step file opening approach may be
+ * the root cause for the sec2 open to return a NULL.
+ * It is prudent then, to collectively fail (early) in this case.
+ */
+ l_error = 1;
+ }
+ MPI_Allreduce(&l_error, &g_error, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
+ if (g_error) {
+ if (file_ptr->ioc_file)
+ H5FD_close(file_ptr->ioc_file);
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file = %s\n", name)
+ }
/* See: H5FDsubfile_int.c: returns error count! */
if (H5FD__open_subfiles((void *)&file_ptr->fa, inode_id, ioc_flags) > 0)
@@ -844,11 +854,7 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t ioc_fapl_id, haddr_t maxa
else if (file_ptr->inode > 0) { /* No errors opening the subfiles */
subfiling_context_t *sf_context = get__subfiling_object(file_ptr->fa.common.context_id);
-#if 0 /* JRM */ /* original */
- if (sf_context) {
-#else /* JRM */ /* Richard's fix */
- if (sf_context && sf_context->topology->rank_is_ioc) {
-#endif
+ if (sf_context && sf_context->topology->rank_is_ioc) {
if (initialize_ioc_threads(sf_context) < 0) {
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Unable to initialize IOC threads")
}
@@ -863,8 +869,7 @@ else
ret_value = (H5FD_t *)file_ptr;
-done : if (NULL == ret_value)
-{
+done : if (NULL == ret_value) {
if (file_ptr) {
if (file_ptr->ioc_file)
H5FD_close(file_ptr->ioc_file);