Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f928a8

Browse files
committed
Fix possible cache invalidation failure in ReceiveSharedInvalidMessages.
Commitfad153e modified sinval.c to reducethe number of calls into sinvaladt.c (which require taking a shared lock)by keeping a local buffer of collected-but-not-yet-processed messages.However, if processing of the last message in a batch resulted in arecursive call to ReceiveSharedInvalidMessages, we could overwrite thatmessage with a new one while the outer invalidation function was stillworking on it. This would be likely to lead to invalidation of the wrongcache entry, allowing subsequent processing to use stale cache data.The fix is just to make a local copy of each message while we're processingit.Spotted by Andres Freund. Back-patch to 8.4 where the bug was introduced.
1 parent3727afa commit0f928a8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎src/backend/storage/ipc/sinval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ ReceiveSharedInvalidMessages(
9191
/* Deal with any messages still pending from an outer recursion */
9292
while (nextmsg<nummsgs)
9393
{
94-
SharedInvalidationMessage*msg=&messages[nextmsg++];
94+
SharedInvalidationMessagemsg=messages[nextmsg++];
9595

9696
SharedInvalidMessageCounter++;
97-
invalFunction(msg);
97+
invalFunction(&msg);
9898
}
9999

100100
do
@@ -121,10 +121,10 @@ ReceiveSharedInvalidMessages(
121121

122122
while (nextmsg<nummsgs)
123123
{
124-
SharedInvalidationMessage*msg=&messages[nextmsg++];
124+
SharedInvalidationMessagemsg=messages[nextmsg++];
125125

126126
SharedInvalidMessageCounter++;
127-
invalFunction(msg);
127+
invalFunction(&msg);
128128
}
129129

130130
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp