Skip to content

CID fixes for ompio #13207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ompi/mca/common/ompio/common_ompio_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
_tbuf = mca_common_ompio_alloc_buf (_fh, _tmp_buf_size==0 ? _max_data : _tmp_buf_size); \
if ( NULL == _tbuf ) { \
opal_output(1, "common_ompio: error allocating memory\n"); \
opal_convertor_cleanup (_convertor); \
return OMPI_ERR_OUT_OF_RESOURCE; \
} \
if (NULL != _decoded_iov) { \
Expand All @@ -43,6 +44,7 @@
_tbuf = mca_common_ompio_alloc_buf (_fh, _tmp_buf_size==0 ? _max_data : _tmp_buf_size); \
if ( NULL == _tbuf ) { \
opal_output(1, "common_ompio: error allocating memory\n"); \
opal_convertor_cleanup (_convertor); \
return OMPI_ERR_OUT_OF_RESOURCE; \
} \
if (NULL != _decoded_iov) { \
Expand Down
1 change: 1 addition & 0 deletions ompi/mca/common/ompio/common_ompio_file_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ int mca_common_ompio_file_read_pipelined (ompio_file_t *fh, void *buf,
tbuf2 = mca_common_ompio_alloc_buf (fh, bytes_per_cycle);
if (NULL == tbuf2) {
opal_output(1, "common_ompio: error allocating memory\n");
opal_convertor_cleanup (&convertor);
return OMPI_ERR_OUT_OF_RESOURCE;
}
unpackbuf = tbuf2;
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/fbtl/posix/fbtl_posix_ipreadv.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ ssize_t mca_fbtl_posix_ipreadv (ompio_file_t *fh,
data->prd_req_type = FBTL_POSIX_AIO_READ;
data->prd_req_chunks = ompi_fbtl_posix_max_prd_active_reqs;
data->prd_total_len = 0;
data->prd_aio.aio_reqs = (struct aiocb *) malloc (sizeof(struct aiocb) *
fh->f_num_of_io_entries);
data->prd_aio.aio_reqs = (struct aiocb *) calloc (fh->f_num_of_io_entries,
sizeof(struct aiocb));
if (NULL == data->prd_aio.aio_reqs) {
opal_output(1, "mca_fbtl_posix_ipreadv: could not allocate memory\n");
free(data);
Expand Down
4 changes: 2 additions & 2 deletions ompi/mca/fbtl/posix/fbtl_posix_ipwritev.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ ssize_t mca_fbtl_posix_ipwritev (ompio_file_t *fh,
data->prd_req_type = FBTL_POSIX_AIO_WRITE;
data->prd_req_chunks = ompi_fbtl_posix_max_prd_active_reqs;
data->prd_total_len = 0;
data->prd_aio.aio_reqs = (struct aiocb *) malloc (sizeof(struct aiocb) *
fh->f_num_of_io_entries);
data->prd_aio.aio_reqs = (struct aiocb *) calloc (fh->f_num_of_io_entries,
sizeof(struct aiocb));
if (NULL == data->prd_aio.aio_reqs) {
opal_output (1,"mca_fbtl_posix_ipwritev: could not allocate memory\n");
free(data);
Expand Down
1 change: 1 addition & 0 deletions ompi/mca/io/ompio/io_ompio_file_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ static void mca_io_ompio_file_get_eof_offset (ompio_file_t *fh,
}

offset = prev_offset;
assert(index_in_file_view > 0);
blocklen = fh->f_fview.f_decoded_iov[index_in_file_view-1].iov_len;
while (offset <= in_offset && k <= blocklen) {
prev_offset = offset;
Expand Down
28 changes: 18 additions & 10 deletions ompi/mca/io/ompio/io_ompio_file_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,18 @@ int mca_io_ompio_file_read_all_begin (ompi_file_t *fh,

data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;
if ( true == fp->f_split_coll_in_use ) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_OTHER;

OPAL_THREAD_LOCK(&fh->f_lock);
if (true == fp->f_split_coll_in_use) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
OPAL_THREAD_UNLOCK(&fh->f_lock);
return MPI_ERR_OTHER;
}
/* No need for locking fh->f_lock, that is done in file_iread_all */
ret = mca_io_ompio_file_iread_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
fp->f_split_coll_in_use = true;
OPAL_THREAD_UNLOCK(&fh->f_lock);

/* No need for locking fh->f_lock for the operation itself, that is done in io_ompio_file_iread_all */
ret = mca_io_ompio_file_iread_all ( fh, buf, count, datatype, &fp->f_split_coll_req );

return ret;
}
Expand Down Expand Up @@ -402,14 +407,17 @@ int mca_io_ompio_file_read_at_all_begin (ompi_file_t *fh,
data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;

if ( true == fp->f_split_coll_in_use ) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_REQUEST;
}
OPAL_THREAD_LOCK(&fh->f_lock);
if (true == fp->f_split_coll_in_use) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
OPAL_THREAD_UNLOCK(&fh->f_lock);
return MPI_ERR_OTHER;
}

fp->f_split_coll_in_use = true;
ret = mca_common_ompio_file_iread_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
OPAL_THREAD_UNLOCK(&fh->f_lock);
fp->f_split_coll_in_use = true;

return ret;
}

Expand Down
26 changes: 16 additions & 10 deletions ompi/mca/io/ompio/io_ompio_file_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,18 @@ int mca_io_ompio_file_write_all_begin (ompi_file_t *fh,

data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;
if ( true == fp->f_split_coll_in_use ) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_OTHER;

OPAL_THREAD_LOCK(&fh->f_lock);
if (true == fp->f_split_coll_in_use) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
OPAL_THREAD_UNLOCK(&fh->f_lock);
return MPI_ERR_OTHER;
}
/* No need for locking fh->f_lock, that is done in file_iwrite_all */
ret = mca_io_ompio_file_iwrite_all ( fh, buf, count, datatype, &fp->f_split_coll_req );
fp->f_split_coll_in_use = true;
OPAL_THREAD_UNLOCK(&fh->f_lock);

/* No need for locking fh->f_lock the operation itself, that is done in io_ompio_file_iwrite_all */
ret = mca_io_ompio_file_iwrite_all ( fh, buf, count, datatype, &fp->f_split_coll_req );

return ret;
}
Expand Down Expand Up @@ -412,14 +417,15 @@ int mca_io_ompio_file_write_at_all_begin (ompi_file_t *fh,
data = (mca_common_ompio_data_t *) fh->f_io_selected_data;
fp = &data->ompio_fh;

if ( true == fp->f_split_coll_in_use ) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
return MPI_ERR_REQUEST;
}
OPAL_THREAD_LOCK(&fh->f_lock);
if (true == fp->f_split_coll_in_use) {
printf("Only one split collective I/O operation allowed per file handle at any given point in time!\n");
OPAL_THREAD_UNLOCK(&fh->f_lock);
return MPI_ERR_OTHER;
}
fp->f_split_coll_in_use = true;
ret = mca_common_ompio_file_iwrite_at_all ( fp, offset, buf, count, datatype, &fp->f_split_coll_req );
OPAL_THREAD_UNLOCK(&fh->f_lock);
fp->f_split_coll_in_use = true;

return ret;
}
Expand Down