9
9
* University of Stuttgart. All rights reserved.
10
10
* Copyright (c) 2004-2005 The Regents of the University of California.
11
11
* All rights reserved.
12
- * Copyright (c) 2008-2015 University of Houston. All rights reserved.
12
+ * Copyright (c) 2008-2021 University of Houston. All rights reserved.
13
13
* Copyright (c) 2015-2018 Research Organization for Information Science
14
14
* and Technology (RIST). All rights reserved.
15
15
* $COPYRIGHT$
33
33
#include "ompi/constants.h"
34
34
#include "ompi/mca/fbtl/fbtl.h"
35
35
36
+ #define MAX_ATTEMPTS 10
37
+
36
38
ssize_t mca_fbtl_posix_ipreadv (ompio_file_t * fh ,
37
39
ompi_request_t * request )
38
40
{
@@ -44,7 +46,7 @@ ssize_t mca_fbtl_posix_ipreadv (ompio_file_t *fh,
44
46
45
47
data = (mca_fbtl_posix_request_data_t * ) malloc ( sizeof (mca_fbtl_posix_request_data_t ));
46
48
if ( NULL == data ) {
47
- opal_output (1 ,"could not allocate memory\n" );
49
+ opal_output (1 ,"mca_fbtl_posix_ipreadv: could not allocate memory\n" );
48
50
return 0 ;
49
51
}
50
52
@@ -56,14 +58,14 @@ ssize_t mca_fbtl_posix_ipreadv (ompio_file_t *fh,
56
58
data -> aio_reqs = (struct aiocb * ) malloc (sizeof (struct aiocb ) *
57
59
fh -> f_num_of_io_entries );
58
60
if (NULL == data -> aio_reqs ) {
59
- opal_output (1 , "OUT OF MEMORY \n" );
61
+ opal_output (1 , "mca_fbtl_posix_ipreadv: could not allocate memory \n" );
60
62
free (data );
61
63
return 0 ;
62
64
}
63
65
64
66
data -> aio_req_status = (int * ) malloc (sizeof (int ) * fh -> f_num_of_io_entries );
65
67
if (NULL == data -> aio_req_status ) {
66
- opal_output (1 , "OUT OF MEMORY \n" );
68
+ opal_output (1 , "mca_fbtl_posix_ipreadv: could not allocate memory \n" );
67
69
free (data -> aio_reqs );
68
70
free (data );
69
71
return 0 ;
@@ -103,14 +105,22 @@ ssize_t mca_fbtl_posix_ipreadv (ompio_file_t *fh,
103
105
}
104
106
105
107
for (i = 0 ; i < data -> aio_last_active_req ; i ++ ) {
106
- if (-1 == aio_read (& data -> aio_reqs [i ])) {
107
- opal_output (1 , "mca_fbtl_posix_ipreadv: error in aio_read(): %s" , strerror (errno ));
108
- mca_fbtl_posix_unlock ( & data -> aio_lock , data -> aio_fh );
109
- free (data -> aio_reqs );
110
- free (data -> aio_req_status );
111
- free (data );
112
- return OMPI_ERROR ;
113
- }
108
+ int counter = 0 ;
109
+ while ( MAX_ATTEMPTS > counter ) {
110
+ if ( -1 != aio_read (& data -> aio_reqs [i ]) ) {
111
+ break ;
112
+ }
113
+ counter ++ ;
114
+ mca_common_ompio_progress ();
115
+ }
116
+ if ( MAX_ATTEMPTS == counter ) {
117
+ opal_output (1 , "mca_fbtl_posix_ipreadv: error in aio_read(): errno %d %s" , errno , strerror (errno ));
118
+ mca_fbtl_posix_unlock ( & data -> aio_lock , data -> aio_fh );
119
+ free (data -> aio_reqs );
120
+ free (data -> aio_req_status );
121
+ free (data );
122
+ return OMPI_ERROR ;
123
+ }
114
124
}
115
125
116
126
req -> req_data = data ;
0 commit comments