1818 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
1919 * Copyright (c) 2016 Research Organization for Information Science
2020 * and Technology (RIST). All rights reserved.
21+ * Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
2122 * $COPYRIGHT$
2223 *
2324 * Additional copyrights may follow
@@ -228,7 +229,7 @@ int ompi_request_default_wait_all( size_t count,
228229 size_t i , completed = 0 , failed = 0 ;
229230 ompi_request_t * * rptr ;
230231 ompi_request_t * request ;
231- int mpi_error = OMPI_SUCCESS ;
232+ int mpi_error = OMPI_SUCCESS , rc ;
232233 ompi_wait_sync_t sync ;
233234
234235 if (OPAL_UNLIKELY (0 == count )) {
@@ -356,13 +357,12 @@ int ompi_request_default_wait_all( size_t count,
356357
357358 if ( request -> req_persistent ) {
358359 request -> req_state = OMPI_REQUEST_INACTIVE ;
359- continue ;
360- }
361- /* Only free the request if there is no error on it */
362- if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
360+ } else if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
361+ /* Only free the request if there is no error on it */
362+
363363 /* If there's an error while freeing the request,
364- assume that the request is still there.
365- Otherwise, Bad Things will happen later! */
364+ assume that the request is still there.
365+ Otherwise, Bad Things will happen later! */
366366 int tmp = ompi_request_free (rptr );
367367 if (OMPI_SUCCESS == mpi_error && OMPI_SUCCESS != tmp ) {
368368 mpi_error = tmp ;
@@ -373,7 +373,6 @@ int ompi_request_default_wait_all( size_t count,
373373 }
374374 }
375375 } else {
376- int rc ;
377376 /* free request if required */
378377 for ( i = 0 ; i < count ; i ++ , rptr ++ ) {
379378 void * _tmp_ptr = & sync ;
@@ -382,8 +381,9 @@ int ompi_request_default_wait_all( size_t count,
382381
383382 if ( request -> req_state == OMPI_REQUEST_INACTIVE ) {
384383 rc = ompi_status_empty .MPI_ERROR ;
385- goto absorb_error_and_continue ;
384+ continue ;
386385 }
386+ rc = OMPI_SUCCESS ;
387387 /*
388388 * Assert only if no requests were failed.
389389 * Since some may still be pending.
@@ -406,7 +406,8 @@ int ompi_request_default_wait_all( size_t count,
406406 rc = MPI_ERR_PROC_FAILED_PENDING ;
407407 }
408408#endif /* OPAL_ENABLE_FT_MPI */
409- goto absorb_error_and_continue ;
409+ mpi_error = MPI_ERR_IN_STATUS ;
410+ continue ;
410411 }
411412 }
412413 assert ( REQUEST_COMPLETE (request ) );
@@ -417,18 +418,12 @@ int ompi_request_default_wait_all( size_t count,
417418 rc = ompi_grequest_invoke_query (request , & request -> req_status );
418419 }
419420
420- rc = request -> req_status .MPI_ERROR ;
421-
422- if ( request -> req_persistent ) {
421+ if (request -> req_persistent ) {
423422 request -> req_state = OMPI_REQUEST_INACTIVE ;
424- } else if (MPI_SUCCESS == rc ) {
423+ } else if (MPI_SUCCESS == request -> req_status . MPI_ERROR ) {
425424 /* Only free the request if there is no error on it */
426- int tmp = ompi_request_free (rptr );
427- if (OMPI_SUCCESS == mpi_error && OMPI_SUCCESS != tmp ) {
428- mpi_error = tmp ;
429- }
425+ rc = ompi_request_free (rptr );
430426 }
431- absorb_error_and_continue :
432427#if OPAL_ENABLE_FT_MPI
433428 if ( (MPI_ERR_PROC_FAILED == rc ) || (MPI_ERR_REVOKED == rc ) ) {
434429 mpi_error = rc ;
@@ -441,7 +436,7 @@ int ompi_request_default_wait_all( size_t count,
441436 * passed to that function."
442437 * So we should do so here as well.
443438 */
444- if ( OMPI_SUCCESS == mpi_error && rc != OMPI_SUCCESS ) {
439+ if ( OMPI_SUCCESS == mpi_error && OMPI_SUCCESS != rc ) {
445440 mpi_error = MPI_ERR_IN_STATUS ;
446441 }
447442 }
0 commit comments