mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
Fix issues in tools code after Subfiling VFD updates (#1973)
This commit is contained in:
parent
b22984600a
commit
597ce3cdbf
@ -380,6 +380,7 @@ done:
|
|||||||
if (ioc_conf) {
|
if (ioc_conf) {
|
||||||
if (ioc_conf->under_fapl_id >= 0 && H5I_dec_ref(ioc_conf->under_fapl_id) < 0)
|
if (ioc_conf->under_fapl_id >= 0 && H5I_dec_ref(ioc_conf->under_fapl_id) < 0)
|
||||||
H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't close IOC under FAPL");
|
H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't close IOC under FAPL");
|
||||||
|
ioc_conf->under_fapl_id = H5I_INVALID_HID;
|
||||||
H5FL_FREE(H5FD_ioc_config_t, ioc_conf);
|
H5FL_FREE(H5FD_ioc_config_t, ioc_conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -749,6 +750,7 @@ H5FD__ioc_fapl_free(void *_fapl)
|
|||||||
|
|
||||||
if (fapl->under_fapl_id >= 0 && H5I_dec_ref(fapl->under_fapl_id) < 0)
|
if (fapl->under_fapl_id >= 0 && H5I_dec_ref(fapl->under_fapl_id) < 0)
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close IOC under FAPL ID");
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close IOC under FAPL ID");
|
||||||
|
fapl->under_fapl_id = H5I_INVALID_HID;
|
||||||
|
|
||||||
/* Free the property list */
|
/* Free the property list */
|
||||||
fapl = H5FL_FREE(H5FD_ioc_config_t, fapl);
|
fapl = H5FL_FREE(H5FD_ioc_config_t, fapl);
|
||||||
@ -841,6 +843,12 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
|||||||
/* Fill in the file config values */
|
/* Fill in the file config values */
|
||||||
HDmemcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_ioc_config_t));
|
HDmemcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_ioc_config_t));
|
||||||
|
|
||||||
|
/* Copy the ioc FAPL. */
|
||||||
|
if (H5FD__copy_plist(config_ptr->under_fapl_id, &(file_ptr->fa.under_fapl_id)) < 0) {
|
||||||
|
file_ptr->fa.under_fapl_id = H5I_INVALID_HID;
|
||||||
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy IOC under FAPL");
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != (file_ptr->file_path = HDrealpath(name, NULL))) {
|
if (NULL != (file_ptr->file_path = HDrealpath(name, NULL))) {
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
char *directory = dirname(path);
|
char *directory = dirname(path);
|
||||||
@ -866,12 +874,8 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
|||||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't resolve subfile path");
|
H5_SUBFILING_SYS_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't resolve subfile path");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the ioc FAPL. */
|
|
||||||
if (H5FD__copy_plist(config_ptr->under_fapl_id, &(file_ptr->fa.under_fapl_id)) < 0)
|
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy IOC under FAPL");
|
|
||||||
|
|
||||||
/* Check the underlying driver (sec2/mpio/etc.) */
|
/* Check the underlying driver (sec2/mpio/etc.) */
|
||||||
if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(config_ptr->under_fapl_id)))
|
if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(file_ptr->fa.under_fapl_id)))
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
|
H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list");
|
||||||
|
|
||||||
if (H5P_peek(plist_ptr, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
|
if (H5P_peek(plist_ptr, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0)
|
||||||
@ -900,9 +904,9 @@ H5FD__ioc_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
|||||||
if (H5F_ACC_EXCL & flags)
|
if (H5F_ACC_EXCL & flags)
|
||||||
ioc_flags |= O_EXCL;
|
ioc_flags |= O_EXCL;
|
||||||
|
|
||||||
file_ptr->ioc_file = H5FD_open(file_ptr->file_path, flags, config_ptr->under_fapl_id, HADDR_UNDEF);
|
file_ptr->ioc_file = H5FD_open(file_ptr->file_path, flags, file_ptr->fa.under_fapl_id, HADDR_UNDEF);
|
||||||
if (file_ptr->ioc_file) {
|
if (file_ptr->ioc_file) {
|
||||||
if (H5FDget_vfd_handle(file_ptr->ioc_file, config_ptr->under_fapl_id, &file_handle) < 0)
|
if (H5FDget_vfd_handle(file_ptr->ioc_file, file_ptr->fa.under_fapl_id, &file_handle) < 0)
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get file handle");
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get file handle");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -956,6 +960,10 @@ done:
|
|||||||
H5_SUBFILING_MPI_DONE_ERROR(NULL, "MPI_Barrier failed", mpi_code);
|
H5_SUBFILING_MPI_DONE_ERROR(NULL, "MPI_Barrier failed", mpi_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config_ptr == &default_config)
|
||||||
|
if (H5I_dec_ref(config_ptr->under_fapl_id) < 0)
|
||||||
|
H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, NULL, "can't close IOC under FAPL");
|
||||||
|
|
||||||
if (NULL == ret_value) {
|
if (NULL == ret_value) {
|
||||||
if (file_ptr) {
|
if (file_ptr) {
|
||||||
if (H5FD__ioc_close_int(file_ptr) < 0)
|
if (H5FD__ioc_close_int(file_ptr) < 0)
|
||||||
|
@ -354,13 +354,7 @@ H5FD_subfiling_init(void)
|
|||||||
"Subfiling VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE");
|
"Subfiling VFD requires the use of MPI_Init_thread with MPI_THREAD_MULTIPLE");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char *env_var;
|
int required = MPI_THREAD_MULTIPLE;
|
||||||
int required = MPI_THREAD_MULTIPLE;
|
|
||||||
|
|
||||||
/* Ensure that Subfiling VFD has been loaded dynamically */
|
|
||||||
env_var = HDgetenv(HDF5_DRIVER);
|
|
||||||
if (!env_var || HDstrcmp(env_var, H5FD_SUBFILING_NAME))
|
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "MPI isn't initialized");
|
|
||||||
|
|
||||||
if (MPI_SUCCESS != (mpi_code = MPI_Init_thread(NULL, NULL, required, &provided)))
|
if (MPI_SUCCESS != (mpi_code = MPI_Init_thread(NULL, NULL, required, &provided)))
|
||||||
H5_SUBFILING_MPI_GOTO_ERROR(H5I_INVALID_HID, "MPI_Init_thread failed", mpi_code);
|
H5_SUBFILING_MPI_GOTO_ERROR(H5I_INVALID_HID, "MPI_Init_thread failed", mpi_code);
|
||||||
@ -467,6 +461,10 @@ H5Pset_fapl_subfiling(hid_t fapl_id, const H5FD_subfiling_config_t *vfd_config)
|
|||||||
|
|
||||||
/*NO TRACE*/
|
/*NO TRACE*/
|
||||||
|
|
||||||
|
/* Ensure Subfiling (and therefore MPI) is initialized before doing anything */
|
||||||
|
if (H5FD_subfiling_init() < 0)
|
||||||
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize subfiling VFD");
|
||||||
|
|
||||||
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
|
if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
|
H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list");
|
||||||
|
|
||||||
@ -913,6 +911,10 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma
|
|||||||
}
|
}
|
||||||
|
|
||||||
HDmemcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_subfiling_config_t));
|
HDmemcpy(&file_ptr->fa, config_ptr, sizeof(H5FD_subfiling_config_t));
|
||||||
|
if (H5FD__copy_plist(config_ptr->ioc_fapl_id, &(file_ptr->fa.ioc_fapl_id)) < 0) {
|
||||||
|
file_ptr->fa.ioc_fapl_id = H5I_INVALID_HID;
|
||||||
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy FAPL");
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL != (file_ptr->file_path = HDrealpath(name, NULL))) {
|
if (NULL != (file_ptr->file_path = HDrealpath(name, NULL))) {
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
@ -939,9 +941,6 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma
|
|||||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't resolve subfile path");
|
H5_SUBFILING_SYS_GOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't resolve subfile path");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H5FD__copy_plist(config_ptr->ioc_fapl_id, &(file_ptr->fa.ioc_fapl_id)) < 0)
|
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't copy FAPL");
|
|
||||||
|
|
||||||
file_ptr->sf_file = H5FD_open(name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF);
|
file_ptr->sf_file = H5FD_open(name, flags, file_ptr->fa.ioc_fapl_id, HADDR_UNDEF);
|
||||||
if (!file_ptr->sf_file)
|
if (!file_ptr->sf_file)
|
||||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open IOC file");
|
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open IOC file");
|
||||||
@ -1011,6 +1010,10 @@ H5FD__subfiling_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t ma
|
|||||||
ret_value = (H5FD_t *)file_ptr;
|
ret_value = (H5FD_t *)file_ptr;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (config_ptr == &default_config)
|
||||||
|
if (H5I_dec_ref(config_ptr->ioc_fapl_id) < 0)
|
||||||
|
H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, NULL, "can't close IOC FAPL");
|
||||||
|
|
||||||
if (NULL == ret_value) {
|
if (NULL == ret_value) {
|
||||||
if (file_ptr) {
|
if (file_ptr) {
|
||||||
/* Participate in possible MPI collectives on failure */
|
/* Participate in possible MPI collectives on failure */
|
||||||
@ -2389,6 +2392,10 @@ H5FD__subfiling_del(const char *name, hid_t fapl)
|
|||||||
H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "unable to delete file");
|
H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "unable to delete file");
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (subfiling_config == &default_config)
|
||||||
|
if (H5I_dec_ref(subfiling_config->ioc_fapl_id) < 0)
|
||||||
|
H5_SUBFILING_DONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "unable to close IOC FAPL");
|
||||||
|
|
||||||
H5_SUBFILING_FUNC_LEAVE_API;
|
H5_SUBFILING_FUNC_LEAVE_API;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,6 +873,12 @@ h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size)
|
|||||||
else if (driver_id == H5FD_HDFS)
|
else if (driver_id == H5FD_HDFS)
|
||||||
driver_name = drivernames[HDFS_VFD_IDX];
|
driver_name = drivernames[HDFS_VFD_IDX];
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef H5_HAVE_SUBFILING_VFD
|
||||||
|
else if (driver_id == H5FD_SUBFILING)
|
||||||
|
driver_name = drivernames[SUBFILING_VFD_IDX];
|
||||||
|
#endif
|
||||||
|
else if (driver_id == H5FD_ONION)
|
||||||
|
driver_name = drivernames[ONION_VFD_IDX];
|
||||||
else
|
else
|
||||||
driver_name = "unknown";
|
driver_name = "unknown";
|
||||||
|
|
||||||
@ -1016,8 +1022,13 @@ h5tools_fopen(const char *fname, unsigned flags, hid_t fapl_id, hbool_t use_spec
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Can we open the file with this combo? */
|
/* Can we open the file with this combo? */
|
||||||
if ((fid = h5tools_fopen(fname, flags, tmp_fapl_id, TRUE, drivername, drivername_size)) >=
|
H5E_BEGIN_TRY
|
||||||
0) {
|
{
|
||||||
|
fid = h5tools_fopen(fname, flags, tmp_fapl_id, TRUE, drivername, drivername_size);
|
||||||
|
}
|
||||||
|
H5E_END_TRY;
|
||||||
|
|
||||||
|
if (fid >= 0) {
|
||||||
used_fapl_id = tmp_fapl_id;
|
used_fapl_id = tmp_fapl_id;
|
||||||
H5TOOLS_GOTO_DONE(fid);
|
H5TOOLS_GOTO_DONE(fid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user