forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit30d8bad
committed
Be more careful about barriers when releasing BackgroundWorkerSlots.
ForgetBackgroundWorker lacked any memory barrier at all, whileBackgroundWorkerStateChange had one but unaccountably didadditional manipulation of the slot after the barrier. AFAICS,the rule must be that the barrier is immediately before settingor clearing slot->in_use.It looks like back in 9.6 when ForgetBackgroundWorker was firstwritten, there might have been some case for not needing abarrier there, but I'm not very convinced of that --- the factthat the load of bgw_notify_pid is in the caller doesn't seemto guarantee no memory ordering problem. So patch 9.6 too.It's likely that this doesn't fix any observable bug on Intelhardware, but machines with weaker memory ordering rules couldhave problems here.Discussion:https://postgr.es/m/4046084.1620244003@sss.pgh.pa.us1 parent8f72bba commit30d8bad
1 file changed
+12
-1
lines changedLines changed: 12 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
330 |
| - | |
331 | 330 |
| |
| 331 | + | |
| 332 | + | |
332 | 333 |
| |
| 334 | + | |
333 | 335 |
| |
334 | 336 |
| |
335 | 337 |
| |
| |||
416 | 418 |
| |
417 | 419 |
| |
418 | 420 |
| |
| 421 | + | |
| 422 | + | |
419 | 423 |
| |
420 | 424 |
| |
421 | 425 |
| |
| |||
428 | 432 |
| |
429 | 433 |
| |
430 | 434 |
| |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
431 | 441 |
| |
432 | 442 |
| |
433 | 443 |
| |
| 444 | + | |
434 | 445 |
| |
435 | 446 |
| |
436 | 447 |
| |
|
0 commit comments
Comments
(0)