summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2021-12-11 04:48:50 (GMT)
committerGitHub <noreply@github.com>2021-12-11 04:48:50 (GMT)
commitdd3c61c38436275220ee9aacae5aaccd7f0c241e (patch)
treedbe304ed8b4d0955cc43ef97eecc1a18e15204c7
parentc0a13fd9d88e27b3996bc76c2927461634de5675 (diff)
downloadhdf5-dd3c61c38436275220ee9aacae5aaccd7f0c241e.zip
hdf5-dd3c61c38436275220ee9aacae5aaccd7f0c241e.tar.gz
hdf5-dd3c61c38436275220ee9aacae5aaccd7f0c241e.tar.bz2
Fixes for async operations (#1272)
Setup VOL wrapping context for each "request" callback Set H5ES_event_t "next" pointer to NULL when appending to event list
-rw-r--r--src/H5ESlist.c2
-rw-r--r--src/H5VLcallback.c72
2 files changed, 68 insertions, 6 deletions
diff --git a/src/H5ESlist.c b/src/H5ESlist.c
index c0e24cc..3180322 100644
--- a/src/H5ESlist.c
+++ b/src/H5ESlist.c
@@ -88,6 +88,8 @@ H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev)
HDassert(el);
HDassert(ev);
+ ev->next = NULL;
+
/* Append event onto the event list */
if (NULL == el->tail)
el->head = el->tail = ev;
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index ace584e..4cf4d53 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -6452,18 +6452,28 @@ done:
herr_t
H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5VL_request_status_t *status)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding internal VOL routine */
if (H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_wait() */
@@ -6546,18 +6556,28 @@ done:
herr_t
H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding internal VOL routine */
if (H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_notify() */
@@ -6639,18 +6659,28 @@ done:
herr_t
H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding internal VOL routine */
if (H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_cancel() */
@@ -6732,19 +6762,29 @@ done:
herr_t
H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding internal VOL routine */
if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_specific() */
@@ -6827,19 +6867,29 @@ done:
herr_t
H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding internal VOL routine */
if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_optional() */
@@ -6958,18 +7008,28 @@ done:
herr_t
H5VL_request_free(const H5VL_object_t *vol_obj)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ hbool_t vol_wrapper_set = FALSE;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
/* Call the corresponding VOL callback */
if (H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_free() */