From f57277f873d3ebd1d01621b2339a2cdad936550f Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Sat, 30 Apr 2022 08:35:45 -0500 Subject: [PATCH 1/2] Fix SWMR/refresh bug hidden by library free lists (#1702) --- src/H5Oflush.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index eeba5259621..913fb3ac169 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -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) @@ -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; @@ -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() */ From 4cac078c2b77fb9a3dd912a03b99c68493cf6774 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Mon, 2 May 2022 14:15:01 -0500 Subject: [PATCH 2/2] Adapt to passed struct insteat of pointer to struct. --- src/H5Oflush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Oflush.c b/src/H5Oflush.c index 913fb3ac169..5f0ba889a9f 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -298,7 +298,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc) /* Hold a copy of the object's file pointer, since closing the object will * invalidate the file pointer in the oloc. */ - file = oloc->file; + file = oloc.file; /* Create empty object location */ obj_loc.oloc = &obj_oloc;