summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-01-31 08:14:11 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-01-31 08:14:11 (GMT)
commit99d70c494d72bed9c2961348a659696090752ac5 (patch)
treebcc7f3e71a8cc0eff7d6f0d9f5379c4b316480bf /src
parent90bf59edc59bfabb38d677dc6bddb12eb57e8b11 (diff)
downloadhdf5-99d70c494d72bed9c2961348a659696090752ac5.zip
hdf5-99d70c494d72bed9c2961348a659696090752ac5.tar.gz
hdf5-99d70c494d72bed9c2961348a659696090752ac5.tar.bz2
Fixed a valgrind issue with the unprotect log message. The logging
call was placed after the point where the cache entry was freed. The fix was to just use the entry's address directly in the log call instead of the entry itself.
Diffstat (limited to 'src')
-rw-r--r--src/H5AC.c2
-rw-r--r--src/H5Clog.c5
-rw-r--r--src/H5Clog.h4
-rw-r--r--src/H5Clog_json.c9
-rw-r--r--src/H5Clog_trace.c7
5 files changed, 12 insertions, 15 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 0a5411a..e1838fb 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -1612,7 +1612,7 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
done:
/* If currently logging, generate a message */
if(f->shared->cache->log_info->logging)
- if(H5C_log_write_unprotect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0)
+ if(H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0)
HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Clog.c b/src/H5Clog.c
index 0ae7f13..cf9b7e8 100644
--- a/src/H5Clog.c
+++ b/src/H5Clog.c
@@ -887,7 +887,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address,
int type_id, unsigned flags, herr_t fxn_ret_value)
{
herr_t ret_value = SUCCEED;
@@ -898,9 +898,8 @@ H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
HDassert(cache);
/* Write a log message */
- HDassert(entry);
if(cache->log_info->cls->write_unprotect_entry_log_msg)
- if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0)
+ if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed")
done:
diff --git a/src/H5Clog.h b/src/H5Clog.h
index 9ba6786..0235c4a 100644
--- a/src/H5Clog.h
+++ b/src/H5Clog.h
@@ -59,7 +59,7 @@ typedef struct H5C_log_class_t {
herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
- herr_t (*write_unprotect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
@@ -102,7 +102,7 @@ H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entr
H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
index ccfa222..dd9e9b2 100644
--- a/src/H5Clog_json.c
+++ b/src/H5Clog_json.c
@@ -41,7 +41,7 @@
/****************/
/* Max log message size */
-#define H5C_MAX_JSON_LOG_MSG_SIZE 128
+#define H5C_MAX_JSON_LOG_MSG_SIZE 1024
/******************/
@@ -87,7 +87,7 @@ static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache
static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
@@ -1232,7 +1232,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
int type_id, unsigned flags, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
@@ -1243,7 +1243,6 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *en
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
- HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
@@ -1257,7 +1256,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *en
\"returned\":%d\
},\n\
"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ , (long long)HDtime(NULL), (unsigned long)address,
type_id, flags, (int)fxn_ret_value);
/* Write the log message to the file */
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
index f7d6889..7c1305c 100644
--- a/src/H5Clog_trace.c
+++ b/src/H5Clog_trace.c
@@ -82,7 +82,7 @@ static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cach
static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
-static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
@@ -872,7 +872,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address,
int type_id, unsigned flags, herr_t fxn_ret_value)
{
H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
@@ -883,11 +883,10 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, const H5C_cache_entry_t *e
/* Sanity checks */
HDassert(trace_udata);
HDassert(trace_udata->message);
- HDassert(entry);
/* Create the log message string */
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
- (unsigned long)(entry->addr), type_id, flags, (int)fxn_ret_value);
+ (unsigned long)(address), type_id, flags, (int)fxn_ret_value);
/* Write the log message to the file */
if(H5C__trace_write_log_message(trace_udata) < 0)