diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 5415604993..7a2e32e265 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1641,6 +1641,15 @@ CheckPointTwoPhase(XLogRecPtr redo_horizon)
 	}
 	LWLockRelease(TwoPhaseStateLock);
 
+	/*
+	 * If any 2PC files have been flushed, do the same for the parent
+	 * directory to make this information durable on disk. On recovery,
+	 * issue the fsync() anyway, individual 2PC files have already been
+	 * flushed when replaying their respective XLOG_XACT_PREPARE record.
+	 */
+	if (serialized_xacts > 0 || RecoveryInProgress())
+		fsync_fname(TWOPHASE_DIR, true);
+
 	TRACE_POSTGRESQL_TWOPHASE_CHECKPOINT_DONE();
 
 	if (log_checkpoints && serialized_xacts > 0)
