From da309ac9628f8118a7633f66821839dcfef98160 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 4 Jan 2016 15:26:27 -0600 Subject: [PATCH] - use a unique pid for each process as requested by the API - sync the file before closing it - use plfs_access() instead of access() before closing the file --- ompi/mca/fs/plfs/fs_plfs_file_close.c | 13 +++++++++++-- ompi/mca/fs/plfs/fs_plfs_file_open.c | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ompi/mca/fs/plfs/fs_plfs_file_close.c b/ompi/mca/fs/plfs/fs_plfs_file_close.c index 9a14b3752c..03b92af91a 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_close.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_close.c @@ -49,7 +49,9 @@ mca_fs_plfs_file_close (mca_io_ompio_file_t *fh) getcwd( wpath, sizeof(wpath) ); sprintf( wpath,"%s/%s",wpath,fh->f_filename ); - if(-1 == access(fh->f_filename, F_OK)) { + plfs_ret = plfs_access(wpath, F_OK); + if ( PLFS_SUCCESS != plfs_ret ) { + opal_output(0, "fs_plfs_file_close: Error in plfs_access:\n%s\n", strplfserr(plfs_ret)); return OMPI_ERROR; // file doesn't exist } @@ -66,7 +68,14 @@ mca_fs_plfs_file_close (mca_io_ompio_file_t *fh) return OMPI_ERROR; } - plfs_ret = plfs_close(fh->f_fs_ptr, 0, 0, amode ,NULL, &flags); + plfs_ret = plfs_sync(fh->f_fs_ptr); + if (PLFS_SUCCESS != plfs_ret) { + opal_output(0, "fs_plfs_file_close: Error in plfs_sync:\n%s\n", strplfserr(plfs_ret)); + return OMPI_ERROR; + } + + + plfs_ret = plfs_close(fh->f_fs_ptr, fh->f_rank, 0, amode ,NULL, &flags); if (PLFS_SUCCESS != plfs_ret) { opal_output(0, "fs_plfs_file_close: Error in plfs_close:\n%s\n", strplfserr(plfs_ret)); return OMPI_ERROR; diff --git a/ompi/mca/fs/plfs/fs_plfs_file_open.c b/ompi/mca/fs/plfs/fs_plfs_file_open.c index 351f24c0ec..877a55ea7e 100644 --- a/ompi/mca/fs/plfs/fs_plfs_file_open.c +++ b/ompi/mca/fs/plfs/fs_plfs_file_open.c @@ -89,7 +89,7 @@ mca_fs_plfs_file_open (struct ompi_communicator_t *comm, if (access_mode & MPI_MODE_CREATE) amode = amode | O_CREAT; - plfs_ret = plfs_open( &pfd, wpath, amode, 0, perm, NULL ); + plfs_ret = plfs_open( &pfd, wpath, amode, fh->f_rank, perm, NULL ); fh->f_fs_ptr = pfd; } @@ -99,7 +99,7 @@ mca_fs_plfs_file_open (struct ompi_communicator_t *comm, } if (0 != rank) { - plfs_ret = plfs_open( &pfd, wpath, amode, 0, perm, NULL ); + plfs_ret = plfs_open( &pfd, wpath, amode, fh->f_rank, perm, NULL ); if (PLFS_SUCCESS != plfs_ret) { opal_output(0, "fs_plfs_file_open: Error in plfs_open:\n%s\n", strplfserr(plfs_ret)); return OMPI_ERROR;