diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index d30a725f90..ea386e7af9 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -1023,6 +1023,19 @@ Delete(File file)
 	DO_DB(_dump_lru());
 }
 
+void FileForceClosed(File file)
+{
+	Vfd		   *vfdP;
+
+	vfdP = &VfdCache[file];
+	if (vfdP->fd != VFD_CLOSED)
+	{
+		close(vfdP->fd);
+		vfdP->fd = VFD_CLOSED;
+		--nfile;
+	}
+}
+
 static void
 LruDelete(File file)
 {
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index bb96881cad..7098bef6a6 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1230,6 +1230,10 @@ mdsync(void)
 									   EXTENSION_RETURN_NULL
 									   | EXTENSION_DONT_CHECK_SIZE);
 
+					/* TEST: cause the file to be reopened afresh every time! */
+					if (seg != NULL)
+						FileForceClosed(seg->mdfd_vfd);
+
 					INSTR_TIME_SET_CURRENT(sync_start);
 
 					if (seg != NULL &&
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index e49b42ce86..c26c4b2a33 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -79,6 +79,7 @@ extern int	FileGetRawDesc(File file);
 extern int	FileGetRawFlags(File file);
 extern mode_t FileGetRawMode(File file);
 extern off_t FileGetSize(File file);
+extern void FileForceClosed(File file);
 
 /* Operations used for sharing named temporary files */
 extern File PathNameCreateTemporaryFile(const char *name, bool error_on_failure);
