summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2016-11-20 16:57:46 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2016-11-20 16:57:46 (GMT)
commit4e7b19f8260a7adb0e3b3df30e2d8289fccdcca6 (patch)
treea8527d110745f16d07ef1fd8a29e8eea84ed57e5 /src
parente10c0e7894699a4113074cd3e9212bafe56a5b40 (diff)
downloadhdf5-4e7b19f8260a7adb0e3b3df30e2d8289fccdcca6.zip
hdf5-4e7b19f8260a7adb0e3b3df30e2d8289fccdcca6.tar.gz
hdf5-4e7b19f8260a7adb0e3b3df30e2d8289fccdcca6.tar.bz2
Two minor cache changes:
* Evict-on-close behavior is now skipped when the file is closing. This fixes a potential issue discovered by Valgind on Windows where potentially garbage data would be availble for manipulation. * Added brackets to some code in the tagged entry evict iterators so that the flag that determines if progress was made only gets set if things are actually evicted. This prevents an infinite loop (and emits an error) when pinned entries prevent eviction and thus progress.
Diffstat (limited to 'src')
-rw-r--r--src/H5Ctag.c5
-rw-r--r--src/H5Fprivate.h3
-rw-r--r--src/H5Fquery.c28
-rw-r--r--src/H5Gint.c2
4 files changed, 34 insertions, 4 deletions
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index fb7ef53..33f7c22 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -465,11 +465,12 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx)
entry and we'll loop back around again (as evicting other
entries will hopefully unpin this entry) */
ctx->pinned_entries_need_evicted = TRUE;
- else
+ else {
/* Evict the Entry */
if(H5C__flush_single_entry(ctx->f, ctx->dxpl_id, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.")
- ctx->evicted_entries_last_pass = TRUE;
+ ctx->evicted_entries_last_pass = TRUE;
+ } /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 35c7b5a..fdf82ed 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -304,6 +304,7 @@
#define H5F_FCPL(F) ((F)->shared->fcpl_id)
#define H5F_GET_FC_DEGREE(F) ((F)->shared->fc_degree)
#define H5F_EVICT_ON_CLOSE(F) ((F)->shared->evict_on_close)
+#define H5F_CLOSING(F) ((F)->closing)
#define H5F_RDCC_NSLOTS(F) ((F)->shared->rdcc_nslots)
#define H5F_RDCC_NBYTES(F) ((F)->shared->rdcc_nbytes)
#define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0)
@@ -353,6 +354,7 @@
#define H5F_FCPL(F) (H5F_get_fcpl(F))
#define H5F_GET_FC_DEGREE(F) (H5F_get_fc_degree(F))
#define H5F_EVICT_ON_CLOSE(F) (H5F_get_evict_on_close(F))
+#define H5F_CLOSING(F) (H5F_get_closing(F))
#define H5F_RDCC_NSLOTS(F) (H5F_rdcc_nslots(F))
#define H5F_RDCC_NBYTES(F) (H5F_rdcc_nbytes(F))
#define H5F_RDCC_W0(F) (H5F_rdcc_w0(F))
@@ -673,6 +675,7 @@ H5_DLL herr_t H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes);
H5_DLL hid_t H5F_get_fcpl(const H5F_t *f);
H5_DLL H5F_close_degree_t H5F_get_fc_degree(const H5F_t *f);
H5_DLL hbool_t H5F_get_evict_on_close(const H5F_t *f);
+H5_DLL hbool_t H5F_get_closing(const H5F_t *f);
H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f);
H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f);
H5_DLL double H5F_rdcc_w0(const H5F_t *f);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index 487eb85..e5e785e 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -837,7 +837,8 @@ H5F_get_fc_degree(const H5F_t *f)
/*-------------------------------------------------------------------------
* Function: H5F_get_evict_on_close
*
- * Purpose: Retrieve the 'file close degree' for the file.
+ * Purpose: Checks if evict-on-close is desired for objects in the
+ * file.
*
* Return: Success: Flag indicating whether the evict-on-close
* property was set for the file.
@@ -862,6 +863,31 @@ H5F_get_evict_on_close(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_closing
+ *
+ * Purpose: Checks if the file is in the process of being closed.
+ *
+ * Return: Success: Flag indicating whether the file is closing.
+ * Failure: (can't happen)
+ *
+ * Programmer: Dana Robinson
+ * Fall 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_get_closing(const H5F_t *f)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->closing)
+} /* end H5F_get_closing() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_store_msg_crt_idx
*
* Purpose: Retrieve the 'store message creation index' flag for the file.
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 90c011a..95682d9 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -502,7 +502,7 @@ H5G_close(H5G_t *grp)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close")
/* Evict group metadata if evicting on close */
- if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) {
+ if(!H5F_CLOSING(grp->oloc.file) && H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) {
if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0)