@@ -81,6 +81,7 @@ dup_NC(const NC *ref)
8181int
8282ncmpio_redef (void * ncdp )
8383{
84+ int err , status = NC_NOERR , mpireturn ;
8485 NC * ncp = (NC * )ncdp ;
8586
8687#if 0
@@ -105,7 +106,24 @@ ncmpio_redef(void *ncdp)
105106 /* we are now entering define mode */
106107 fSet (ncp -> flags , NC_MODE_DEF );
107108
108- return NC_NOERR ;
109+ /* must reset fileview as header extent may later change in enddef() */
110+ TRACE_IO (MPI_File_set_view )(ncp -> collective_fh , 0 , MPI_BYTE ,
111+ MPI_BYTE , "native" , MPI_INFO_NULL );
112+ if (mpireturn != MPI_SUCCESS ) {
113+ err = ncmpii_error_mpi2nc (mpireturn , "MPI_File_set_view" );
114+ DEBUG_ASSIGN_ERROR (status , err )
115+ }
116+
117+ if (ncp -> independent_fh != MPI_FILE_NULL ) {
118+ TRACE_IO (MPI_File_set_view )(ncp -> independent_fh , 0 , MPI_BYTE ,
119+ MPI_BYTE , "native" , MPI_INFO_NULL );
120+ if (mpireturn != MPI_SUCCESS ) {
121+ err = ncmpii_error_mpi2nc (mpireturn , "MPI_File_set_view" );
122+ DEBUG_ASSIGN_ERROR (status , err )
123+ }
124+ }
125+
126+ return status ;
109127}
110128
111129/*----< ncmpio_begin_indep_data() >------------------------------------------*/
0 commit comments