|
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) 2018 Cisco Systems, Inc. All rights reserved
|
14 | 14 | * Copyright (c) 2018 Research Organization for Information Science
|
15 | 15 | * and Technology (RIST). All rights reserved.
|
@@ -127,14 +127,57 @@ bool mca_fbtl_posix_progress ( mca_ompio_request_t *req)
|
127 | 127 | if ( EINPROGRESS == data->aio_req_status[i] ) {
|
128 | 128 | data->aio_req_status[i] = aio_error ( &data->aio_reqs[i]);
|
129 | 129 | if ( 0 == data->aio_req_status[i]){
|
130 |
| - data->aio_open_reqs--; |
131 |
| - lcount++; |
132 | 130 | /* assuming right now that aio_return will return
|
133 | 131 | ** the number of bytes written/read and not an error code,
|
134 | 132 | ** since aio_error should have returned an error in that
|
135 | 133 | ** case and not 0 ( which means request is complete)
|
136 | 134 | */
|
137 |
| - data->aio_total_len += aio_return (&data->aio_reqs[i]); |
| 135 | + ssize_t ret2 = aio_return (&data->aio_reqs[i]); |
| 136 | + data->aio_total_len += ret2; |
| 137 | + if ( data->aio_reqs[i].aio_nbytes != (size_t)ret2 ) { |
| 138 | + /* Partial completion */ |
| 139 | + data->aio_reqs[i].aio_offset += ret2; |
| 140 | + data->aio_reqs[i].aio_buf = (char*)data->aio_reqs[i].aio_buf + ret2; |
| 141 | + data->aio_reqs[i].aio_nbytes -= ret2; |
| 142 | + data->aio_reqs[i].aio_reqprio = 0; |
| 143 | + data->aio_reqs[i].aio_sigevent.sigev_notify = SIGEV_NONE; |
| 144 | + data->aio_req_status[i] = EINPROGRESS; |
| 145 | + start_offset = data->aio_reqs[i].aio_offset; |
| 146 | + total_length = data->aio_reqs[i].aio_nbytes; |
| 147 | + if ( data->aio_req_type == FBTL_POSIX_WRITE ) { |
| 148 | + ret_code = mca_fbtl_posix_lock( &data->aio_lock, data->aio_fh, F_WRLCK, start_offset, total_length, OMPIO_LOCK_ENTIRE_REGION ); |
| 149 | + if ( 0 < ret_code ) { |
| 150 | + opal_output(1, "mca_fbtl_posix_progress: error in mca_fbtl_posix_lock() %d", ret_code); |
| 151 | + /* Just in case some part of the lock actually succeeded. */ |
| 152 | + mca_fbtl_posix_unlock ( &data->aio_lock, data->aio_fh ); |
| 153 | + return OMPI_ERROR; |
| 154 | + } |
| 155 | + if (-1 == aio_write(&data->aio_reqs[i])) { |
| 156 | + opal_output(1, "mca_fbtl_posix_progress: error in aio_write()"); |
| 157 | + mca_fbtl_posix_unlock ( &data->aio_lock, data->aio_fh ); |
| 158 | + return OMPI_ERROR; |
| 159 | + } |
| 160 | + } |
| 161 | + else if ( data->aio_req_type == FBTL_POSIX_READ ) { |
| 162 | + ret_code = mca_fbtl_posix_lock( &data->aio_lock, data->aio_fh, F_RDLCK, start_offset, total_length, OMPIO_LOCK_ENTIRE_REGION ); |
| 163 | + if ( 0 < ret_code ) { |
| 164 | + opal_output(1, "mca_fbtl_posix_progress: error in mca_fbtl_posix_lock() %d", ret_code); |
| 165 | + /* Just in case some part of the lock actually succeeded. */ |
| 166 | + mca_fbtl_posix_unlock ( &data->aio_lock, data->aio_fh ); |
| 167 | + return OMPI_ERROR; |
| 168 | + } |
| 169 | + if (-1 == aio_read(&data->aio_reqs[i])) { |
| 170 | + opal_output(1, "mca_fbtl_posix_progress: error in aio_read()"); |
| 171 | + mca_fbtl_posix_unlock ( &data->aio_lock, data->aio_fh ); |
| 172 | + return OMPI_ERROR; |
| 173 | + } |
| 174 | + mca_fbtl_posix_unlock ( &data->aio_lock, data->aio_fh ); |
| 175 | + } |
| 176 | + } |
| 177 | + else { |
| 178 | + data->aio_open_reqs--; |
| 179 | + lcount++; |
| 180 | + } |
138 | 181 | }
|
139 | 182 | else if ( EINPROGRESS == data->aio_req_status[i]){
|
140 | 183 | /* not yet done */
|
|
0 commit comments