1313 * Copyright (c) 2006-2008 Cisco Systems, Inc. All rights reserved.
1414 * Copyright (c) 2010-2012 Oracle and/or its affiliates. All rights reserved.
1515 * Copyright (c) 2012 Oak Ridge National Labs. All rights reserved.
16+ * Copyright (c) 2025 NVIDIA Corporation. All rights reserved.
1617 * $COPYRIGHT$
1718 *
1819 * Additional copyrights may follow
@@ -136,7 +137,7 @@ int ompi_request_default_test_any(
136137
137138 if ( request -> req_persistent ) {
138139 request -> req_state = OMPI_REQUEST_INACTIVE ;
139- return OMPI_SUCCESS ;
140+ return request -> req_status . MPI_ERROR ;
140141 }
141142 /* If there is an error on the request, don't free it */
142143 if (MPI_SUCCESS != request -> req_status .MPI_ERROR ) {
@@ -248,27 +249,26 @@ int ompi_request_default_test_all(
248249 ompi_grequest_invoke_query (request , & request -> req_status );
249250 }
250251 OMPI_COPY_STATUS (& statuses [i ], request -> req_status , true);
251- if ( request -> req_persistent ) {
252- request -> req_state = OMPI_REQUEST_INACTIVE ;
253- continue ;
254- }
255- /* MPI-2:4.5.1 says that we can return MPI_ERR_IN_STATUS
256- even if MPI_STATUSES_IGNORE was used. Woot! */
257- /* Only free the request if there was no error on it */
258252 if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
259- int tmp = ompi_request_free (rptr );
260- if (tmp != OMPI_SUCCESS ) {
261- return tmp ;
262- }
263- } else {
264253 rc = MPI_ERR_IN_STATUS ;
265254#if OPAL_ENABLE_FT_MPI
266255 if (MPI_ERR_PROC_FAILED == request -> req_status .MPI_ERROR
267- || MPI_ERR_REVOKED == request -> req_status .MPI_ERROR ) {
256+ || MPI_ERR_REVOKED == request -> req_status .MPI_ERROR ) {
268257 rc = request -> req_status .MPI_ERROR ;
269258 }
270259#endif /* OPAL_ENABLE_FT_MPI */
271260 }
261+ if (request -> req_persistent ) {
262+ request -> req_state = OMPI_REQUEST_INACTIVE ;
263+ } else if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
264+ /* MPI-2:4.5.1 says that we can return MPI_ERR_IN_STATUS
265+ even if MPI_STATUSES_IGNORE was used. Woot! */
266+ /* Only free the request if there was no error on it */
267+ int tmp = ompi_request_free (rptr );
268+ if (tmp != OMPI_SUCCESS ) {
269+ return tmp ;
270+ }
271+ }
272272 }
273273 } else {
274274 /* free request if required */
@@ -283,25 +283,24 @@ int ompi_request_default_test_all(
283283 if (OMPI_REQUEST_GEN == request -> req_type ) {
284284 ompi_grequest_invoke_query (request , & request -> req_status );
285285 }
286- if ( request -> req_persistent ) {
287- request -> req_state = OMPI_REQUEST_INACTIVE ;
288- continue ;
289- }
290- /* Only free the request if there was no error */
291- if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
292- int tmp = ompi_request_free (rptr );
293- if (tmp != OMPI_SUCCESS ) {
294- return tmp ;
295- }
296- } else {
286+ if (MPI_SUCCESS != request -> req_status .MPI_ERROR ) {
297287 rc = MPI_ERR_IN_STATUS ;
298288#if OPAL_ENABLE_FT_MPI
299289 if (MPI_ERR_PROC_FAILED == request -> req_status .MPI_ERROR
300- || MPI_ERR_REVOKED == request -> req_status .MPI_ERROR ) {
290+ || MPI_ERR_REVOKED == request -> req_status .MPI_ERROR ) {
301291 rc = request -> req_status .MPI_ERROR ;
302292 }
303293#endif /* OPAL_ENABLE_FT_MPI */
304294 }
295+ if (request -> req_persistent ) {
296+ request -> req_state = OMPI_REQUEST_INACTIVE ;
297+ } else if (MPI_SUCCESS == request -> req_status .MPI_ERROR ) {
298+ /* Only free the request if there was no error */
299+ int tmp = ompi_request_free (rptr );
300+ if (tmp != OMPI_SUCCESS ) {
301+ return tmp ;
302+ }
303+ }
305304 }
306305 }
307306
@@ -398,7 +397,7 @@ int ompi_request_default_test_some(
398397#endif /* OPAL_ENABLE_FT_MPI */
399398 }
400399
401- if ( request -> req_persistent ) {
400+ if ( request -> req_persistent ) {
402401 request -> req_state = OMPI_REQUEST_INACTIVE ;
403402 } else {
404403 /* Only free the request if there was no error */
0 commit comments