diff options
author | David Young <dyoung@hdfgroup.org> | 2019-09-12 19:16:49 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2019-09-12 19:16:49 (GMT) |
commit | 1f4dd5692d16a9638e8be3d208eb05ccaedd3c62 (patch) | |
tree | b38a67a5ce8c21bcd3232e9fc12c31301f2f3b89 /src/H5FDvfd_swmr.c | |
parent | 0a81436fab1692ed394f83b6d595ad9a32cbc285 (diff) | |
download | hdf5-1f4dd5692d16a9638e8be3d208eb05ccaedd3c62.zip hdf5-1f4dd5692d16a9638e8be3d208eb05ccaedd3c62.tar.gz hdf5-1f4dd5692d16a9638e8be3d208eb05ccaedd3c62.tar.bz2 |
Use h5_retry_init/_next to retry loading the SWMR shadow file.
Diffstat (limited to 'src/H5FDvfd_swmr.c')
-rw-r--r-- | src/H5FDvfd_swmr.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c index eb659e1..8765876 100644 --- a/src/H5FDvfd_swmr.c +++ b/src/H5FDvfd_swmr.c @@ -258,10 +258,8 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, H5P_genplist_t *plist; /* Property list pointer */ H5F_vfd_swmr_config_t *vfd_swmr_config = /* Points to VFD SWMR */ NULL; /* configuration */ - unsigned file_retries = /* Maximum retries for opening */ - H5FD_VFD_SWMR_MD_FILE_RETRY_MAX; /* md file */ - uint64_t nanosec = 1; /* # of nanoseconds to sleep */ - /* between retries */ + h5_retry_t retry; /* retry state */ + bool do_try; /* more tries remain */ H5FD_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -306,16 +304,17 @@ H5FD_vfd_swmr_open(const char *name, unsigned flags, hid_t fapl_id, file->md_file_path[sizeof(file->md_file_path) - 1] = '\0'; /* Retry on opening the metadata file */ - do { + for (do_try = h5_retry_init(&retry, vfd_swmr_config->md_open_tries, + H5_RETRY_DEFAULT_MINIVAL, + H5_RETRY_DEFAULT_MAXIVAL); + do_try != 0; + do_try = h5_retry_next(&retry)) { if((file->md_fd = HDopen(file->md_file_path, O_RDONLY)) >= 0) break; - /* Sleep and double the sleep time on next retry */ - H5_nanosleep(nanosec); - nanosec *= 2; - } while (--file_retries); + } /* Exhaust all retries for opening the md file */ - if(file_retries == 0) + if(!do_try) HGOTO_ERROR(H5E_VFL, H5E_OPENERROR, NULL, \ "unable to open the metadata file after all retry attempts") |