Skip to content

Commit aeaaef2

Browse files
committed
io/ompio: fix for CID 1645290
move the lock protection to include setting the flag indicating that a split collective is already ongoing. Unify the handling for write_all_begin, write_at_all_begin, read_all_begin, read_at_all_begin (even if coverty only complained about one of them). Signed-off-by: Edgar Gabriel <[email protected]>
1 parent cc747f4 commit aeaaef2

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

ompi/mca/io/ompio/io_ompio_file_read.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,11 @@ int mca_io_ompio_file_read_all_begin (ompi_file_t *fh,
366366
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
367367
return MPI_ERR_OTHER;
368368
}
369-
/* No need for locking fh->f_lock, that is done in file_iread_all */
369+
370+
OPAL_THREAD_LOCK(&fh->f_lock);
370371
ret = mca_io_ompio_file_iread_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
371372
fp->f_split_coll_in_use = true;
373+
OPAL_THREAD_UNLOCK(&fh->f_lock);
372374

373375
return ret;
374376
}
@@ -408,8 +410,8 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
408410
}
409411
OPAL_THREAD_LOCK(&fh->f_lock);
410412
ret = mca_common_ompio_file_iread_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
411-
OPAL_THREAD_UNLOCK(&fh->f_lock);
412413
fp->f_split_coll_in_use = true;
414+
OPAL_THREAD_UNLOCK(&fh->f_lock);
413415
return ret;
414416
}
415417

ompi/mca/io/ompio/io_ompio_file_write.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,11 @@ int mca_io_ompio_file_write_all_begin (ompi_file_t *fh,
374374
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
375375
return MPI_ERR_OTHER;
376376
}
377-
/* No need for locking fh->f_lock, that is done in file_iwrite_all */
377+
378+
OPAL_THREAD_LOCK(&fh->f_lock);
378379
ret = mca_io_ompio_file_iwrite_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
379380
fp->f_split_coll_in_use = true;
381+
OPAL_THREAD_UNLOCK(&fh->f_lock);
380382

381383
return ret;
382384
}
@@ -418,8 +420,8 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
418420
}
419421
OPAL_THREAD_LOCK(&fh->f_lock);
420422
ret = mca_common_ompio_file_iwrite_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
421-
OPAL_THREAD_UNLOCK(&fh->f_lock);
422423
fp->f_split_coll_in_use = true;
424+
OPAL_THREAD_UNLOCK(&fh->f_lock);
423425

424426
return ret;
425427
}

0 commit comments

Comments
 (0)