mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-19 16:50:46 +08:00
[svn-r5419] Purpose:
Bug fix. Description: Added barrier to flush routine to prevent race condition where file could be truncated. Platforms tested: IRIX64 6.5 (modi4)
This commit is contained in:
parent
390209e72e
commit
2e2a1d8e31
@ -1617,8 +1617,19 @@ H5FD_mpio_flush(H5FD_t *_file)
|
||||
#else /* OLD_WAY */
|
||||
if (haddr_to_MPIOff(file->eoa, &mpi_off)<0)
|
||||
HRETURN_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset");
|
||||
|
||||
/* Extend the file's size */
|
||||
if (MPI_SUCCESS != MPI_File_set_size(file->f, mpi_off))
|
||||
HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_File_set_size failed");
|
||||
|
||||
/* Don't let any proc return until all have extended the file.
|
||||
* (Prevents race condition where some processes go ahead and write
|
||||
* more data to the file before all the processes have finished making
|
||||
* it the shorter length, potentially truncating the file and dropping
|
||||
* the new data written)
|
||||
*/
|
||||
if (MPI_SUCCESS!= MPI_Barrier(file->comm))
|
||||
HRETURN_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "MPI_Barrier failed");
|
||||
#endif /* OLD_WAY */
|
||||
|
||||
/* Update the 'last' eoa value */
|
||||
|
Loading…
x
Reference in New Issue
Block a user