1
1

make ompio return gracefully in case something goes wrong early in file_open.

Этот коммит содержится в:
Edgar Gabriel 2015-07-20 10:03:16 -05:00
родитель 86c3000e18
Коммит b484784dca
2 изменённых файлов: 22 добавлений и 7 удалений

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008-2014 University of Houston. All rights reserved.
* Copyright (c) 2008-2015 University of Houston. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2015 Research Organization for Information Science
@ -257,7 +257,7 @@ file_query(struct ompi_file_t *file,
/* Allocate a space for this module to hang private data (e.g.,
the OMPIO file handle) */
data = malloc(sizeof(mca_io_ompio_data_t));
data = calloc(1, sizeof(mca_io_ompio_data_t));
if (NULL == data) {
return NULL;
}

Просмотреть файл

@ -80,6 +80,9 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
int remote_arch;
ompio_fh->f_iov_type = MPI_DATATYPE_NULL;
ompio_fh->f_comm = MPI_COMM_NULL;
if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) +
((amode&MPI_MODE_WRONLY)?1:0) != 1 ) {
return MPI_ERR_AMODE;
@ -94,7 +97,6 @@ ompio_io_ompio_file_open (ompi_communicator_t *comm,
return MPI_ERR_AMODE;
}
ompio_fh->f_iov_type = MPI_DATATYPE_NULL;
ompio_fh->f_rank = ompi_comm_rank (comm);
ompio_fh->f_size = ompi_comm_size (comm);
remote_arch = opal_local_arch;
@ -319,14 +321,27 @@ ompio_io_ompio_file_close (mca_io_ompio_file_t *ompio_fh)
if( NULL != ompio_fh->f_sharedfp ){
ret = ompio_fh->f_sharedfp->sharedfp_file_close(ompio_fh);
}
ret = ompio_fh->f_fs->fs_file_close (ompio_fh);
if ( NULL != ompio_fh->f_fs ) {
/* The pointer might not be set if file_close() is
** called from the file destructor in case of an error
** during file_open()
*/
ret = ompio_fh->f_fs->fs_file_close (ompio_fh);
}
if ( delete_flag && 0 == ompio_fh->f_rank ) {
mca_io_ompio_file_delete ( ompio_fh->f_filename, MPI_INFO_NULL );
}
mca_fs_base_file_unselect (ompio_fh);
mca_fbtl_base_file_unselect (ompio_fh);
mca_fcoll_base_file_unselect (ompio_fh);
if ( NULL != ompio_fh->f_fs ) {
mca_fs_base_file_unselect (ompio_fh);
}
if ( NULL != ompio_fh->f_fbtl ) {
mca_fbtl_base_file_unselect (ompio_fh);
}
if ( NULL != ompio_fh->f_fcoll ) {
mca_fcoll_base_file_unselect (ompio_fh);
}
if ( NULL != ompio_fh->f_sharedfp) {
mca_sharedfp_base_file_unselect (ompio_fh);
}