@@ -370,13 +370,18 @@ int mca_io_ompio_file_write_all_begin (ompi_file_t *fh,
370
370
371
371
data = (mca_common_ompio_data_t * ) fh -> f_io_selected_data ;
372
372
fp = & data -> ompio_fh ;
373
- if ( true == fp -> f_split_coll_in_use ) {
374
- printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
375
- return MPI_ERR_OTHER ;
373
+
374
+ OPAL_THREAD_LOCK (& fh -> f_lock );
375
+ if (true == fp -> f_split_coll_in_use ) {
376
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
377
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
378
+ return MPI_ERR_OTHER ;
376
379
}
377
- /* No need for locking fh->f_lock, that is done in file_iwrite_all */
378
- ret = mca_io_ompio_file_iwrite_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
379
380
fp -> f_split_coll_in_use = true;
381
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
382
+
383
+ /* No need for locking fh->f_lock the operation itself, that is done in io_ompio_file_iwrite_all */
384
+ ret = mca_io_ompio_file_iwrite_all ( fh , buf , count , datatype , & fp -> f_split_coll_req );
380
385
381
386
return ret ;
382
387
}
@@ -412,14 +417,15 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
412
417
data = (mca_common_ompio_data_t * ) fh -> f_io_selected_data ;
413
418
fp = & data -> ompio_fh ;
414
419
415
- if ( true == fp -> f_split_coll_in_use ) {
416
- printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
417
- return MPI_ERR_REQUEST ;
418
- }
419
420
OPAL_THREAD_LOCK (& fh -> f_lock );
421
+ if (true == fp -> f_split_coll_in_use ) {
422
+ printf ("Only one split collective I/O operation allowed per file handle at any given point in time!\n" );
423
+ OPAL_THREAD_UNLOCK (& fh -> f_lock );
424
+ return MPI_ERR_OTHER ;
425
+ }
426
+ fp -> f_split_coll_in_use = true;
420
427
ret = mca_common_ompio_file_iwrite_at_all ( fp , offset , buf , count , datatype , & fp -> f_split_coll_req );
421
428
OPAL_THREAD_UNLOCK (& fh -> f_lock );
422
- fp -> f_split_coll_in_use = true;
423
429
424
430
return ret ;
425
431
}
0 commit comments