Skip to content

Commit

Permalink
Fix bad H5VL_t rc on H5O_refresh_metadata fail
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Jul 9, 2024
1 parent 96acf6c commit 12ae3ec
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/H5Oflush.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,11 @@ H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag)
herr_t
H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
{
H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
bool objs_incr = false; /* Whether the object count in the file was incremented */
H5F_t *file = NULL;
herr_t ret_value = SUCCEED; /* Return value */
H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
bool objs_incr = false; /* Whether the object count in the file was incremented */
H5F_t *file = NULL;
herr_t ret_value = SUCCEED; /* Return value */
bool conn_id_incr = false; /* Whether the VOL connector ID has been incremented */

FUNC_ENTER_NOAPI(FAIL)

Expand Down Expand Up @@ -233,6 +234,7 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
* If you don't do this, VDS refreshes can accidentally close the connector.
*/
connector->nrefs++;
conn_id_incr = true;

/* Close object & evict its metadata */
if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0)
Expand All @@ -244,6 +246,7 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)

/* Restore the number of references on the VOL connector */
connector->nrefs--;
conn_id_incr = false;

/* Restore important datatype state */
if (H5I_get_type(oid) == H5I_DATATYPE)
Expand All @@ -256,6 +259,10 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
if (objs_incr && file)
H5F_decr_nopen_objs(file);

if (vol_obj && vol_obj->connector)
if (conn_id_incr)
vol_obj->connector->nrefs--;

FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_refresh_metadata() */

Expand Down

0 comments on commit 12ae3ec

Please sign in to comment.