summaryrefslogtreecommitdiff
path: root/cpukit/libblock/src/media.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libblock/src/media.c')
-rw-r--r--cpukit/libblock/src/media.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/cpukit/libblock/src/media.c b/cpukit/libblock/src/media.c
index 5b2b06b5b2..c176e12243 100644
--- a/cpukit/libblock/src/media.c
+++ b/cpukit/libblock/src/media.c
@@ -420,26 +420,30 @@ static rtems_status_code process_event(
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
+ rtems_status_code sc_retry = RTEMS_SUCCESSFUL;
rtems_media_state state = RTEMS_MEDIA_STATE_FAILED;
char *dest = NULL;
- sc = notify(event, RTEMS_MEDIA_STATE_INQUIRY, src, NULL);
- if (sc == RTEMS_SUCCESSFUL) {
- state = RTEMS_MEDIA_STATE_READY;
- } else {
- state = RTEMS_MEDIA_STATE_ABORTED;
- }
-
- sc = (*worker)(state, src, &dest, worker_arg);
- if (state == RTEMS_MEDIA_STATE_READY) {
+ do {
+ sc = notify(event, RTEMS_MEDIA_STATE_INQUIRY, src, NULL);
if (sc == RTEMS_SUCCESSFUL) {
- state = RTEMS_MEDIA_STATE_SUCCESS;
+ state = RTEMS_MEDIA_STATE_READY;
} else {
- state = RTEMS_MEDIA_STATE_FAILED;
+ state = RTEMS_MEDIA_STATE_ABORTED;
+ }
+
+ sc = (*worker)(state, src, &dest, worker_arg);
+ if (state == RTEMS_MEDIA_STATE_READY) {
+ if (sc == RTEMS_SUCCESSFUL) {
+ state = RTEMS_MEDIA_STATE_SUCCESS;
+ } else {
+ state = RTEMS_MEDIA_STATE_FAILED;
+ }
}
- }
- notify(event, state, src, dest);
+ sc_retry = notify(event, state, src, dest);
+ } while (state == RTEMS_MEDIA_STATE_FAILED
+ && sc_retry == RTEMS_INCORRECT_STATE);
remember_event(event, state, src, dest);
if (state == RTEMS_MEDIA_STATE_SUCCESS) {
@@ -504,6 +508,7 @@ static rtems_status_code mount_worker(
if (rv != 0) {
rmdir(mount_path);
free(mount_path);
+ (*mount_options.converter->handler->destroy)(mount_options.converter);
return RTEMS_IO_ERROR;
}