Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SWMR/refresh bug hidden by library free lists (#1702) #1711

Merged
merged 2 commits into from
May 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/H5Oflush.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,9 @@ H5Orefresh(hid_t oid)
herr_t
H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
{
H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
H5VL_object_t *vol_obj = NULL; /* VOL object associated with the ID */
hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
H5F_t * file = NULL;
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
Expand All @@ -294,6 +295,11 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
H5O_shared_t cached_H5O_shared;
H5VL_t * connector = NULL;

/* Hold a copy of the object's file pointer, since closing the object will
* invalidate the file pointer in the oloc.
*/
file = oloc.file;

/* Create empty object location */
obj_loc.oloc = &obj_oloc;
obj_loc.path = &obj_path;
Expand Down Expand Up @@ -342,8 +348,8 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
} /* end if */

done:
if (objs_incr)
H5F_decr_nopen_objs(oloc.file);
if (objs_incr && file)
H5F_decr_nopen_objs(file);

FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata() */
Expand Down