From c96e0f006fb24066d6c03a07b339741a9cefe081 Mon Sep 17 00:00:00 2001 From: Edgar Gabriel Date: Thu, 23 May 2019 13:48:57 -0500 Subject: [PATCH] common/ompio: fix division by zero problem with empty fview When using an empty fileview, a division by zero bug can occur in ompio. Not entirely sure why the problem did not show up previously, but some recent changes trigger that bug in one of our tests. This pr is part of a fix applied in commit f6b3a0a Fixes Issue #6703 Signed-off-by: Edgar Gabriel --- ompi/mca/common/ompio/common_ompio_file_open.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ompi/mca/common/ompio/common_ompio_file_open.c b/ompi/mca/common/ompio/common_ompio_file_open.c index d16a90fc03c..350ee2b924f 100644 --- a/ompi/mca/common/ompio/common_ompio_file_open.c +++ b/ompi/mca/common/ompio/common_ompio_file_open.c @@ -9,8 +9,8 @@ * University of Stuttgart. All rights reserved. * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. - * Copyright (c) 2008-2017 University of Houston. All rights reserved. - * Copyright (c) 2015-2017 Research Organization for Information Science + * Copyright (c) 2008-2019 University of Houston. All rights reserved. + * Copyright (c) 2015-2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2016 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2017 IBM Corporation. All rights reserved. @@ -381,6 +381,13 @@ int mca_common_ompio_file_get_position (mca_io_ompio_file_t *fh, { OMPI_MPI_OFFSET_TYPE off; + if ( 0 == fh->f_view_extent || + 0 == fh->f_view_size || + 0 == fh->f_etype_size ) { + *offset = 0; + return OMPI_SUCCESS; + } + /* No. of copies of the entire file view */ off = (fh->f_offset - fh->f_disp)/fh->f_view_extent;