diff --git a/src/backend/access/gin/ginbtree.c b/src/backend/access/gin/ginbtree.c
index a133a34e8d5182e35d1bc1b35b9aa50c51cf874b..9b0f82fc90461a84cb23010dee30aa105687f1ec 100644
--- a/src/backend/access/gin/ginbtree.c
+++ b/src/backend/access/gin/ginbtree.c
@@ -543,6 +543,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
 
 		MarkBufferDirty(rbuffer);
 		MarkBufferDirty(stack->buffer);
+		if (BufferIsValid(childbuf))
+			MarkBufferDirty(childbuf);
 
 		/*
 		 * Restore the temporary copies over the real buffers. But don't free
@@ -571,6 +573,8 @@ ginPlaceToPage(GinBtree btree, GinBtreeStack *stack,
 			PageSetLSN(BufferGetPage(rbuffer), recptr);
 			if (stack->parent == NULL)
 				PageSetLSN(BufferGetPage(lbuffer), recptr);
+			if (BufferIsValid(childbuf))
+				PageSetLSN(childpage, recptr);
 		}
 		END_CRIT_SECTION();