summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Young <dyoung@hdfgroup.org>2019-10-02 20:48:50 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2019-10-02 20:48:50 (GMT)
commitb1b98cfafe5acb229037e391c1e33812aa53b3bb (patch)
treeee0faf492285b76ffcfdab58001ac993c71588df
parent5025be74eaf8b85d51ce74b6076c8c625dc9b9c2 (diff)
downloadhdf5-b1b98cfafe5acb229037e391c1e33812aa53b3bb.zip
hdf5-b1b98cfafe5acb229037e391c1e33812aa53b3bb.tar.gz
hdf5-b1b98cfafe5acb229037e391c1e33812aa53b3bb.tar.bz2
F ix off-by-one bug affecting metadata-read retries: retries == tries - 1.
-rw-r--r--src/H5C.c8
-rw-r--r--src/H5retry_private.h4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/H5C.c b/src/H5C.c
index 372e184..033f1ec 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -7189,7 +7189,7 @@ H5C_load_entry(H5F_t * f,
/* Get the on-disk entry image */
if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) {
- unsigned retries; /* The # of retries */
+ unsigned tries; /* The # of retries */
htri_t chk_ret; /* return from verify_chksum callback */
size_t actual_len = len; /* The actual length, after speculative */
/* reads have been resolved */
@@ -7376,13 +7376,13 @@ H5C_load_entry(H5F_t * f,
}
/* Calculate and track the # of retries */
- if ((retries = h5_retry_retries(&retry)) != 0) { /* Does not track 0 retry */
+ if ((tries = h5_retry_tries(&retry)) > 1) { /* Does not track 0 retry */
if ( H5F_track_metadata_read_retries(f, (unsigned)type->mem_type,
- retries) < 0)
+ tries - 1) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \
- "cannot track read tries = %u ", retries)
+ "cannot track read tries = %u ", tries)
}
/* Set the final length (in case it wasn't set earlier) */
diff --git a/src/H5retry_private.h b/src/H5retry_private.h
index 03568ef..83ed310 100644
--- a/src/H5retry_private.h
+++ b/src/H5retry_private.h
@@ -88,11 +88,11 @@ h5_retry_next(struct h5_retry_t *r)
return true;
}
-/* Return the number of retries performed since `h5_retry_init()`
+/* Return the number of tries performed since `h5_retry_init()`
* was called on `r`.
*/
static inline unsigned
-h5_retry_retries(struct h5_retry_t *r)
+h5_retry_tries(struct h5_retry_t *r)
{
return r->maxtries - r->tries;
}