summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c13
-rw-r--r--src/H5C.c21
-rw-r--r--src/H5Fint.c16
-rw-r--r--src/H5MF.c6
-rw-r--r--src/H5PB.c9
-rw-r--r--src/H5PBprivate.h2
6 files changed, 47 insertions, 20 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index a561852..be41b6a 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -611,6 +611,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
/* Sanity check */
HDassert(f);
+ HDassert(f->shared);
HDassert(f->shared->cache);
#if H5AC_DUMP_STATS_ON_CLOSE
@@ -641,9 +642,17 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id)
/* Sanity check */
HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC);
- /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */
- if(H5AC__flush_entries(f, dxpl_id) < 0)
+ /* If the file was opened R/W, attempt to flush all entries
+ * from rank 0 & Bcast clean list to other ranks.
+ *
+ * Must not flush in the R/O case, as this will trigger the
+ * free space manager settle routines.
+ */
+ if ( ( H5F_ACC_RDWR & H5F_INTENT(f) ) &&
+ ( H5AC__flush_entries(f, dxpl_id) < 0 ) )
+
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush")
+
#endif /* H5_HAVE_PARALLEL */
/* Destroy the cache */
diff --git a/src/H5C.c b/src/H5C.c
index 120abb8..2ba9f2d 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -761,7 +761,10 @@ H5C_prep_for_file_close(H5F_t *f, hid_t dxpl_id)
HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image")
#ifdef H5_HAVE_PARALLEL
- if(!image_generated && cache_ptr->aux_ptr != NULL && f->shared->fs_persist) {
+ if ( ( H5F_INTENT(f) & H5F_ACC_RDWR ) &&
+ ( ! image_generated ) &&
+ ( cache_ptr->aux_ptr != NULL ) &&
+ ( f->shared->fs_persist ) ) {
/* If persistent free space managers are enabled, flushing the
* metadata cache may result in the deletion, insertion, and/or
* dirtying of entries.
@@ -7295,14 +7298,20 @@ H5C__make_space_in_cache(H5F_t *f, hid_t dxpl_id, size_t space_needed,
prev_ptr = entry_ptr->aux_prev;
+ if ( ( !(entry_ptr->prefetched_dirty) )
#ifdef H5_HAVE_PARALLEL
- if(!(entry_ptr->coll_access)) {
+ && ( ! (entry_ptr->coll_access) )
#endif /* H5_HAVE_PARALLEL */
- if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry")
-#ifdef H5_HAVE_PARALLEL
+ ) {
+
+ if ( H5C__flush_single_entry(f, dxpl_id, entry_ptr,
+ H5C__FLUSH_INVALIDATE_FLAG |
+ H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0 )
+
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \
+ "unable to flush entry")
+
} /* end if */
-#endif /* H5_HAVE_PARALLEL */
/* we are scanning the clean LRU, so the serialize function
* will not be called on any entry -- thus there is no
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 794be50..3a2b422 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -1006,8 +1006,15 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file")
+ /* Set up I/O info for operation */
+ fio_info.f = f;
+ if(NULL == (fio_info.meta_dxpl = (H5P_genplist_t *)H5I_object(meta_dxpl_id)))
+ HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+ if(NULL == (fio_info.raw_dxpl = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id)))
+ HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
+
/* Shutdown the page buffer cache */
- if(H5PB_dest(f) < 0)
+ if(H5PB_dest(f, &fio_info) < 0)
/* Push error, but keep going*/
HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache")
@@ -1027,13 +1034,6 @@ H5F__dest(H5F_t *f, hid_t meta_dxpl_id, hid_t raw_dxpl_id, hbool_t flush)
f->shared->root_grp = NULL;
} /* end if */
- /* Set up I/O info for operation */
- fio_info.f = f;
- if(NULL == (fio_info.meta_dxpl = (H5P_genplist_t *)H5I_object(meta_dxpl_id)))
- HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
- if(NULL == (fio_info.raw_dxpl = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id)))
- HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list")
-
/* Destroy other components of the file */
if(H5F__accum_reset(&fio_info, TRUE) < 0)
/* Push error, but keep going*/
diff --git a/src/H5MF.c b/src/H5MF.c
index 358e326..87c910c 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -1347,6 +1347,12 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r
HDassert(f);
HDassert(H5F_INTENT(f) & H5F_ACC_RDWR);
+ if(f->shared->first_alloc_dealloc) {
+ HDassert(! H5AC_cache_image_pending(f));
+ if(H5MF_tidy_self_referential_fsm_hack(f, dxpl_id) < 0)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed")
+ } /* end if */
+
/* Set mapped type, treating global heap as raw data */
map_type = (alloc_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : alloc_type;
diff --git a/src/H5PB.c b/src/H5PB.c
index c67ae59..ad61657 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -468,7 +468,7 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
/*-------------------------------------------------------------------------
* Function: H5PB_dest
*
- * Purpose: destroy the PB on the file.
+ * Purpose: Flush and destroy the PB on the file if it exists.
*
* Return: Non-negative on success/Negative on failure
*
@@ -477,7 +477,7 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
*-------------------------------------------------------------------------
*/
herr_t
-H5PB_dest(H5F_t *f)
+H5PB_dest(H5F_t *f, const H5F_io_info2_t *fio_info)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -486,11 +486,14 @@ H5PB_dest(H5F_t *f)
/* Sanity checks */
HDassert(f);
- /* Destroy page buffer info, if there is any */
+ /* flush and destroy the page buffer, if it exists */
if(f->shared->page_buf) {
H5PB_t *page_buf = f->shared->page_buf;
H5PB_ud1_t op_data; /* Iteration context */
+ if(H5PB_flush(fio_info)<0)
+ HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer")
+
/* Set up context info */
op_data.page_buf = page_buf;
diff --git a/src/H5PBprivate.h b/src/H5PBprivate.h
index 3b5dcae..3933029 100644
--- a/src/H5PBprivate.h
+++ b/src/H5PBprivate.h
@@ -89,7 +89,7 @@ typedef struct H5PB_t {
/* General routines */
H5_DLL herr_t H5PB_create(H5F_t *file, size_t page_buffer_size, unsigned page_buf_min_meta_perc, unsigned page_buf_min_raw_perc);
H5_DLL herr_t H5PB_flush(const H5F_io_info2_t *fio_info);
-H5_DLL herr_t H5PB_dest(H5F_t *file);
+H5_DLL herr_t H5PB_dest(H5F_t *file, const H5F_io_info2_t *fio_info);
H5_DLL herr_t H5PB_add_new_page(H5F_t *f, H5FD_mem_t type, haddr_t page_addr);
H5_DLL herr_t H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf);
H5_DLL herr_t H5PB_remove_entry(const H5F_t *f, haddr_t addr);