diff options
author | Robert Kim Yates <rkyates@llnl.gov> | 1998-12-07 23:21:41 (GMT) |
---|---|---|
committer | Robert Kim Yates <rkyates@llnl.gov> | 1998-12-07 23:21:41 (GMT) |
commit | 5ba9869b4984935f3ee7eddc1337859ef50aa61e (patch) | |
tree | caf9cd5a407139b68e12bebd17ab687b2afe860b /src/H5Fmpio.c | |
parent | bf250c6bb28b13f3a4f986a6eab52c5c70ee84b6 (diff) | |
download | hdf5-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/H5Fmpio.c')
-rw-r--r-- | src/H5Fmpio.c | 10 |
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 */ |