summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRobert Kim Yates <rkyates@llnl.gov>1998-12-07 23:21:41 (GMT)
committerRobert Kim Yates <rkyates@llnl.gov>1998-12-07 23:21:41 (GMT)
commit5ba9869b4984935f3ee7eddc1337859ef50aa61e (patch)
treecaf9cd5a407139b68e12bebd17ab687b2afe860b /src
parentbf250c6bb28b13f3a4f986a6eab52c5c70ee84b6 (diff)
downloadhdf5-5ba9869b4984935f3ee7eddc1337859ef50aa61e.zip
hdf5-5ba9869b4984935f3ee7eddc1337859ef50aa61e.tar.gz
hdf5-5ba9869b4984935f3ee7eddc1337859ef50aa61e.tar.bz2
[svn-r961] Added barrier after MPI_File_set_size to prevent race condition:
subsequent writes were being truncated, causing holes in file.
Diffstat (limited to 'src')
-rw-r--r--src/H5Fmpio.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/H5Fmpio.c b/src/H5Fmpio.c
index a9ac303..cbe10ed 100644
--- a/src/H5Fmpio.c
+++ b/src/H5Fmpio.c
@@ -295,6 +295,10 @@ H5F_mpio_access(const char *name, const H5F_access_t *access_parms, int mode,
* Added H5F_mpio_Debug debug flags controlled by MPI_Info.
*
* rky 980828 Init flag controlling redundant metadata writes to disk.
+ *
+ * rky 19981207 Added barrier after MPI_File_set_size to prevent
+ * race condition: subsequent writes were being truncated,
+ * causing holes in file.
*-------------------------------------------------------------------------
*/
static H5F_low_t *
@@ -354,6 +358,12 @@ H5F_mpio_open(const char *name, const H5F_access_t *access_parms, uintn flags,
HRETURN_ERROR(H5E_IO, H5E_CANTOPENFILE, NULL,
"MPI_File_set_size failed trying to truncate file" );
}
+ /* Don't let any proc return until all have truncated the file. */
+ mpierr = MPI_Barrier( access_parms->u.mpio.comm );
+ if (MPI_SUCCESS!=mpierr) {
+ MPI_File_close( &fh );
+ HRETURN_ERROR( H5E_IO, H5E_MPI, NULL, "MPI_Barrier failed" );
+ }
}
/* Build the return value */