@@ -362,13 +362,22 @@ int mca_io_ompio_file_read_all_begin (ompi_file_t *fh,
362
362
363
363
data = (mca_common_ompio_data_t * ) fh -> f_io_selected_data ;
364
364
fp = & data -> ompio_fh ;
365
- if ( true == fp -> f_split_coll_in_use ) {
366
- printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
367
- return MPI_ERR_OTHER ;
365
+ if (true == fp -> f_split_coll_in_use ) {
366
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
367
+ return MPI_ERR_OTHER ;
368
+ }
369
+
370
+ OPAL_THREAD_LOCK (& fh -> f_lock );
371
+ if (true == fp -> f_split_coll_in_use ) {
372
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
373
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
374
+ return MPI_ERR_OTHER ;
368
375
}
369
- /* No need for locking fh->f_lock, that is done in file_iread_all */
370
- ret = mca_io_ompio_file_iread_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
371
376
fp -> f_split_coll_in_use = true;
377
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
378
+
379
+ /* No need for locking fh->f_lock for the operation itself, that is done in io_ompio_file_iread_all */
380
+ ret = mca_io_ompio_file_iread_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
372
381
373
382
return ret ;
374
383
}
@@ -402,14 +411,22 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
402
411
data = (mca_common_ompio_data_t * ) fh -> f_io_selected_data ;
403
412
fp = & data -> ompio_fh ;
404
413
405
- if ( true == fp -> f_split_coll_in_use ) {
406
- printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
407
- return MPI_ERR_REQUEST ;
414
+ if (true == fp -> f_split_coll_in_use ) {
415
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
416
+ return MPI_ERR_REQUEST ;
408
417
}
418
+
409
419
OPAL_THREAD_LOCK (& fh -> f_lock );
420
+ if (true == fp -> f_split_coll_in_use ) {
421
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
422
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
423
+ return MPI_ERR_REQUEST ;
424
+ }
425
+
426
+ fp -> f_split_coll_in_use = true;
410
427
ret = mca_common_ompio_file_iread_at_all ( fp , offset , buf , count , datatype , & fp -> f_split_coll_req );
411
428
OPAL_THREAD_UNLOCK (& fh -> f_lock );
412
- fp -> f_split_coll_in_use = true;
429
+
413
430
return ret ;
414
431
}
415
432
0 commit comments