From 2d17eb91656fcd5ff19de1859a51a3d2d8783c7f Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 10 Feb 1998 00:15:42 -0500 Subject: [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. --- src/H5F.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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"); -- cgit v0.12