diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2015-09-03 19:39:10 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2015-09-03 19:39:10 (GMT) |
commit | c102869b66899956c1658b3d99955f23402c1276 (patch) | |
tree | 14fc8be8588c6016f58fe6adb4c05c04045b1368 | |
parent | 3218e2bc88885a98b44b603229bb8843aa6924b7 (diff) | |
download | hdf5-c102869b66899956c1658b3d99955f23402c1276.zip hdf5-c102869b66899956c1658b3d99955f23402c1276.tar.gz hdf5-c102869b66899956c1658b3d99955f23402c1276.tar.bz2 |
[svn-r27672] Bug fix: for a swmr_write, remove file lock after flushing status_flags in superblock.
-rw-r--r-- | src/H5Fint.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 93d9948..61c0eee 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -1271,17 +1271,20 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write/SWMR write (may use <h5clear file> to clear file consistency flags)") file->shared->sblock->status_flags |= H5F_SUPER_WRITE_ACCESS; - - if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE) { /* Remove the file lock for SWMR_WRITE */ + if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE) file->shared->sblock->status_flags |= H5F_SUPER_SWMR_WRITE_ACCESS; - if(H5FD_unlock(file->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file") - } + /* Flush the superblock */ if(H5F_super_dirty(file) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, NULL, "unable to mark superblock as dirty") if(H5F_flush_tagged_metadata(file, (haddr_t)0, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock") + + /* Remove the file lock for SWMR_WRITE */ + if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE) { + if(H5FD_unlock(file->shared->lf) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file") + } } else { /* H5F_ACC_RDONLY */ if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) { /* Check consistency of status_flags */ if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS && !(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) |