summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>1998-02-10 05:15:42 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>1998-02-10 05:15:42 (GMT)
commit2d17eb91656fcd5ff19de1859a51a3d2d8783c7f (patch)
tree8be27aed1cedfa83b6f6da494a2b8a029f06b378 /src
parent4c2346ff5dff516e4f512d1d06e9670a4ab3964a (diff)
downloadhdf5-2d17eb91656fcd5ff19de1859a51a3d2d8783c7f.zip
hdf5-2d17eb91656fcd5ff19de1859a51a3d2d8783c7f.tar.gz
hdf5-2d17eb91656fcd5ff19de1859a51a3d2d8783c7f.tar.bz2
[svn-r232] Problem: Parallel H5Fcreate failed if file doesnot exist. When the
file does not exist, the code tried to open the file with EXCL CREATE. ROMIO cannot handle file-open with EXCL Create due to racing problem. The first process creates the file which then fails all other processes. Solution: In the parallel code, turn on TRUNC mode to allow "late" open calls to succeed too. It is safe to force TRUNC mode since the file is known non-existing at that point. The MPIO implementation has to provide the real solution. Platform tested: O2K with ROMIO.
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 7f83eb6..fd922a5 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -725,9 +725,21 @@ H5F_open(const H5F_low_class_t *type, const char *name, uintn flags,
HRETURN_ERROR(H5E_FILE, H5E_BADVALUE, NULL,
"can't create file without write intent");
}
+#ifdef HAVE_PARALLEL
+ /* ROMIO cannot handle file-open with EXCL Create due to racing problem */
+ /* The first process creates the file which then fails all */
+ /* other processes. Turn on TRUNC bit here. It does not matter */
+ /* since the file does not exist at this point. */
+ fd = H5F_low_open(type, name,
+ H5F_ACC_WRITE | H5F_ACC_CREAT |
+ (flags & H5F_ACC_TRUNC),
+ &search);
+#else
fd = H5F_low_open(type, name,
- H5F_ACC_WRITE | H5F_ACC_CREAT | H5F_ACC_EXCL,
+ H5F_ACC_WRITE | H5F_ACC_CREAT |
+ (flags & H5F_ACC_EXCL) | (flags & H5F_ACC_TRUNC),
&search);
+#endif /*HAVE_PARALLEL*/
if (!fd) {
HRETURN_ERROR(H5E_FILE, H5E_CANTCREATE, NULL,
"can't create file");