From f5ca9237a296f6deefb633b6fb1d61daea4b4f6e Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Tue, 27 Jun 2023 23:36:12 -0500 Subject: Fix assertion failure when attempting to use IOC VFD directly (#3187) --- release_docs/RELEASE.txt | 11 +++++++++++ src/H5FDsubfiling/H5FDioc.c | 13 +++++++++++++ testpar/CMakeTests.cmake | 1 + testpar/t_subfiling_vfd.c | 41 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index f87631a..225b17e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -249,6 +249,17 @@ Bug Fixes since HDF5-1.14.0 release =================================== Library ------- + - Fixed an assertion failure when attempting to use the Subfiling IOC + VFD directly + + The Subfiling feature makes use of two Virtual File Drivers, the + Subfiling VFD and the IOC (I/O Concentrator) VFD. The two VFDs are + intended to be stacked together such that the Subfiling VFD sits + "on top" of the IOC VFD and routes I/O requests through it; using the + IOC VFD alone is currently unsupported. The IOC VFD has been fixed so + that an error message is displayed in this situation rather than causing + an assertion failure. + - Fixed a potential bug when copying empty enum datatypes Copying an empty enum datatype (including implicitly, as when an enum diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index c9fc920..d403e3c 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -819,6 +819,19 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Retrieve the HDF5 stub file ID for the current file */ if (H5_subfiling_get_file_id_prop(plist_ptr, &file_ptr->file_id) < 0) H5_SUBFILING_GOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get stub file ID from FAPL"); + if (file_ptr->file_id == UINT64_MAX) { + /* Since this VFD does no displaying of error stacks itself + * (it relies on the Subfiling VFD to do this), we must print + * the error stack here if we know it wasn't stacked under the + * Subfiling VFD. + */ + H5_SUBFILING_DONE_ERROR( + H5E_PLIST, H5E_BADVALUE, NULL, + "subfiling stub file ID property was missing from FAPL - IOC VFD wasn't correctly stacked under " + "the Subfiling VFD and cannot currently be used alone"); + PRINT_ERROR_STACK; + goto done; + } /* * Open the subfiles for this HDF5 file. A subfiling diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake index a77535c..dfdde59 100644 --- a/testpar/CMakeTests.cmake +++ b/testpar/CMakeTests.cmake @@ -99,6 +99,7 @@ set (test_par_CLEANFILES MPItest.h5 ShapeSameTest.h5 test_subfiling_basic_create.h5 + test_subfiling_only_ioc_fail.h5 test_subfiling_config_file.h5 test_subfiling_stripe_sizes.h5 test_subfiling_selection_strategies.h5 diff --git a/testpar/t_subfiling_vfd.c b/testpar/t_subfiling_vfd.c index 10a4dd2..04d8762 100644 --- a/testpar/t_subfiling_vfd.c +++ b/testpar/t_subfiling_vfd.c @@ -91,6 +91,7 @@ static hid_t create_subfiling_ioc_fapl(MPI_Comm comm, MPI_Info info, hbool_t cus /* Test functions */ static void test_create_and_close(void); +static void test_ioc_only_fail(void); static void test_config_file(void); static void test_stripe_sizes(void); static void test_selection_strategies(void); @@ -102,6 +103,7 @@ static void test_subfiling_h5fuse(void); static test_func tests[] = { test_create_and_close, + test_ioc_only_fail, test_config_file, test_stripe_sizes, test_selection_strategies, @@ -219,6 +221,45 @@ test_create_and_close(void) #undef SUBF_FILENAME /* + * A simple test that ensures file creation fails when + * attempting to use the IOC VFD by itself, without it + * being stacked under the Subfiling VFD. This is + * currently unsupported. + */ +#define SUBF_FILENAME "test_subfiling_only_ioc_fail.h5" +static void +test_ioc_only_fail(void) +{ + hid_t file_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + + curr_nerrors = nerrors; + + if (MAINPROCESS) + TESTING_2("invalid use of IOC VFD by itself"); + + /* Setup a FAPL using only the IOC VFD */ + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id >= 0), "H5Pcreate succeeded"); + + VRFY((H5Pset_mpi_params(fapl_id, comm_g, info_g) >= 0), "H5Pset_mpi_params succeeded"); + + VRFY((H5Pset_fapl_ioc(fapl_id, NULL) >= 0), "H5Pset_fapl_ioc succeeded"); + + H5E_BEGIN_TRY + { + file_id = H5Fcreate(SUBF_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + } + H5E_END_TRY; + VRFY((file_id < 0), "H5Fcreate failed successfully"); + + VRFY((H5Pclose(fapl_id) >= 0), "FAPL close succeeded"); + + CHECK_PASSED(); +} +#undef SUBF_FILENAME + +/* * Test to check that Subfiling configuration file matches * what is expected for a given configuration */ -- cgit v0.12