From 03cdbe93763ef40bc9ed4b05f44e917f0c84c777 Mon Sep 17 00:00:00 2001 From: David Young Date: Fri, 10 Jul 2020 15:23:38 -0500 Subject: Straggler from previous commit: when closing the VFD SWMR virtual file, clear the lower virtual file's `exc_owner` field. While I'm here, remove a gratuitous assertion. This is part of a changeset that helps us avoid creating multiple H5F_shared_t for one file when virtual datasets are used with VFD SWMR. The old code for deduplicating VFD SWMR H5F_shared_t instances did not work correctly with VFD SWMR, so we'd end up with multiple H5F_shared_t all active on the same file. --- src/H5FDvfd_swmr.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index af633e3..ab80a82 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -406,8 +406,18 @@ H5FD_vfd_swmr_close(H5FD_t *_file) FUNC_ENTER_NOAPI_NOINIT - /* Sanity check */ - HDassert(file); + if (file->hdf5_file_lf != NULL) { + if (file->hdf5_file_lf->exc_owner != NULL) { + assert(file->hdf5_file_lf->exc_owner == &file->pub); + file->hdf5_file_lf->exc_owner = NULL; + } + + /* Close the underlying file */ + if (H5FD_close(file->hdf5_file_lf) < 0) + /* Push error, but keep going */ + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, \ + "unable to close the HDF5 file") + } vfd_swmr_reader_did_increase_tick_to(0); @@ -421,12 +431,6 @@ H5FD_vfd_swmr_close(H5FD_t *_file) free(file->api_elapsed_ticks); } - /* Close the underlying file */ - if(file->hdf5_file_lf && H5FD_close(file->hdf5_file_lf) < 0) - /* Push error, but keep going */ - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, \ - "unable to close the HDF5 file") - /* Close the metadata file */ if(file->md_fd >= 0 && HDclose(file->md_fd) < 0) /* Push error, but keep going */ -- cgit v0.12