>From bcc8c1aa5672331b10671a3ae458ac17bea67a91 Mon Sep 17 00:00:00 2001
From: Rob Latham <robl@mcs.anl.gov>
Date: Mon, 24 Mar 2014 16:49:18 -0500
Subject: [PATCH] fix fs detection when multiple fs exist

ROMIO code assumes all processes will use the same ROMIO driver.  we
were not reaching the "find a common file system" logic when NFS was
enabled, everyone stat-ed the file system without errors, but some
processees found a different file system (like if some processes are
writing to NFS and others to UFS)

See discussion beginning here:
http://lists.mpich.org/pipermail/discuss/2014-March/002403.html
---
 src/mpi/romio/adio/common/ad_fstype.c | 42 ++++++++++++++++-------------------
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/src/mpi/romio/adio/common/ad_fstype.c b/src/mpi/romio/adio/common/ad_fstype.c
index ca971291..365ce480 100644
--- a/src/mpi/romio/adio/common/ad_fstype.c
+++ b/src/mpi/romio/adio/common/ad_fstype.c
@@ -686,32 +686,28 @@ void ADIO_ResolveFileType(MPI_Comm comm, const char *filename, int *fstype,
 	    }
 	} else {
 	    ADIO_FileSysType_fncall(filename, &file_system, &myerrcode);
-	    if (myerrcode != MPI_SUCCESS) {
-		*error_code = myerrcode;
 
-		/* the check for file system type will hang if any process got
-		 * an error in ADIO_FileSysType_fncall.  Processes encountering
-		 * an error will return early, before the collective file
-		 * system type check below.  This case could happen if a full
-		 * path exists on one node but not on others, and no prefix
-		 * like ufs: was provided.  see discussion at
-		 * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html
-		 * (edit: now
-		 * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html)
-	         */
-
-	        MPI_Allreduce(error_code, &max_code, 1, MPI_INT, MPI_MAX, comm);
-		if (max_code != MPI_SUCCESS)  {
-		    *error_code = max_code;
-		    return;
-		} 
-		/* ensure everyone came up with the same file system type */
-		MPI_Allreduce(&file_system, &min_code, 1, MPI_INT, 
-			MPI_MIN, comm);
-		if (min_code == ADIO_NFS) file_system = ADIO_NFS;
+	    /* the check for file system type will hang if any process got
+	     * an error in ADIO_FileSysType_fncall.  Processes encountering
+	     * an error will return early, before the collective file
+	     * system type check below.  This case could happen if a full
+	     * path exists on one node but not on others, and no prefix
+	     * like ufs: was provided.  see discussion at
+	     * http://www.mcs.anl.gov/web-mail-archive/lists/mpich-discuss/2007/08/msg00042.html
+	     * (edit: now
+	     * http://lists.mcs.anl.gov/pipermail/mpich-discuss/2007-August/002648.html)
+	     */
+
+	    MPI_Allreduce(&myerrcode, &max_code, 1, MPI_INT, MPI_MAX, comm);
+	    if (max_code != MPI_SUCCESS)  {
+		*error_code = max_code;
+		return;
 	    }
+	    /* ensure everyone came up with the same file system type */
+	    MPI_Allreduce(&file_system, &min_code, 1, MPI_INT,
+		    MPI_MIN, comm);
+	    if (min_code == ADIO_NFS) file_system = ADIO_NFS;
 	}
-
     }
     else {
 	/* prefix specified; just match via prefix and assume everyone got 
-- 
1.8.3.2

