From d3a8d38cc6d1d79ab879a7c4616a40302a56c5af Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 23 Jan 2017 08:52:28 -0600 Subject: [PATCH 1/2] common/ompio: correctly position shared fp in append mode Fixes a bug reported on the mailing list. ompio did only reposition the individual file pointer when the file was opened in append mode. Set the shared file pointer also to point to the end of the file, similarly to the individual file pointer. Signed-off-by: Edgar Gabriel --- .../mca/common/ompio/common_ompio_file_open.c | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index b133b54c5a..6aa8f5de91 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -9,7 +9,7 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2016 University of Houston. All rights reserved. + * Copyright (c) 2008-2017 University of Houston. All rights reserved. * Copyright (c) 2015 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. @@ -204,10 +204,28 @@ int mca_common_ompio_file_open (ompi_communicator_t *comm, file pointer of OMPIO to the very end of the file. */ if ( ompio_fh->f_amode & MPI_MODE_APPEND ) { OMPI_MPI_OFFSET_TYPE current_size; + mca_sharedfp_base_module_t * shared_fp_base_module; ompio_fh->f_fs->fs_file_get_size( ompio_fh, ¤t_size); mca_common_ompio_set_explicit_offset (ompio_fh, current_size); + if ( true == use_sharedfp ) { + if ( NULL != ompio_fh->f_sharedfp && + (!mca_io_ompio_sharedfp_lazy_open || + !strcmp (ompio_fh->f_sharedfp_component->mca_component_name, + "addproc") )) { + + shared_fp_base_module = ompio_fh->f_sharedfp; + ret = shared_fp_base_module->sharedfp_seek(ompio_fh,current_size, MPI_SEEK_SET); + } + else { + opal_output(1, "mca_common_ompio_file_open: Could not adjust position of " + "shared file pointer whith MPI_MODE_APPEND\n"); + ret = MPI_ERR_OTHER; + goto fn_fail; + } + } + } From 3eae0eecd0f1ba696104b890890cb0e8321ca6af Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Mon, 23 Jan 2017 08:59:22 -0600 Subject: [PATCH 2/2] io/ompio: change default for sharedfp_lazy_open parameter Revert the logic of io_ompio_sharedfp_lazy_open. The user now has to explicitely disable shared fp in order for the structures not to be allocated. Otherwise, resetting the shared fp e.g. in case the file was opened in append mode will not work correctly, the code could deadlock. Signed-off-by: Edgar Gabriel --- ompi/mca/io/ompio/io_ompio_component.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ompi/mca/io/ompio/io_ompio_component.c b/ompi/mca/io/ompio/io_ompio_component.c index 3a99fb5874..bf89140cc0 100644 --- a/ompi/mca/io/ompio/io_ompio_component.c +++ b/ompi/mca/io/ompio/io_ompio_component.c @@ -36,7 +36,7 @@ int mca_io_ompio_bytes_per_agg = OMPIO_PREALLOC_MAX_BUF_SIZE; int mca_io_ompio_num_aggregators = -1; int mca_io_ompio_record_offset_info = 0; int mca_io_ompio_coll_timing_info = 0; -int mca_io_ompio_sharedfp_lazy_open = 1; +int mca_io_ompio_sharedfp_lazy_open = 0; int mca_io_ompio_grouping_option=5; @@ -193,7 +193,7 @@ static int register_component(void) &mca_io_ompio_num_aggregators); - mca_io_ompio_sharedfp_lazy_open = 1; + mca_io_ompio_sharedfp_lazy_open = 0; (void) mca_base_component_var_register(&mca_io_ompio_component.io_version, "sharedfp_lazy_open", "lazy allocation of internal shared file pointer structures",