Skip to content

Commit cbb3cb9

Browse files
committed
fs/ufs: avoid using the exclusive flag with shared file pointer
when a file is opened a second time for shared file pointer operations, avoid setting the create and exclusive flag. Signed-off-by: Edgar Gabriel <[email protected]>
1 parent f5289a1 commit cbb3cb9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ompi/mca/fs/ufs/fs_ufs_file_open.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,12 @@ mca_fs_ufs_file_open (struct ompi_communicator_t *comm,
7171

7272
if ( 0 == rank ) {
7373
/* MODE_CREATE and MODE_EXCL can only be set by one process */
74-
if ( access_mode & MPI_MODE_CREATE )
75-
amode = amode | O_CREAT;
76-
if (access_mode & MPI_MODE_EXCL)
77-
amode = amode | O_EXCL;
74+
if ( !(fh->f_flags & OMPIO_SHAREDFP_IS_SET)) {
75+
if ( access_mode & MPI_MODE_CREATE )
76+
amode = amode | O_CREAT;
77+
if (access_mode & MPI_MODE_EXCL)
78+
amode = amode | O_EXCL;
79+
}
7880
fh->fd = open (filename, amode, perm);
7981
ret = fh->fd;
8082
}

0 commit comments

Comments
 (0)