Fix minor nbtree page deletion buffer lock issue.
Peter Geoghegan <pg@bowt.ie>
Fix minor nbtree page deletion buffer lock issue. Avoid accessing the deletion target page's special area during nbtree page deletion at a point where there is no buffer lock held. This issue was detected by a patch that extends Valgrind's memcheck tool to mark nbtree pages that are unsafe to access (due to not having a buffer lock or buffer pin) as NOACCESS. We do hold a buffer pin at this point, and only access the special area, so the old approach was safe. Even still, it seems like a good idea to tighten up the rules in this area. There is no reason to not simply insist on always holding a buffer lock (not just a pin) when accessing nbtree pages. Update some related comments in passing. Discussion: https://postgr.es/m/CAH2-WzkLgyN3zBvRZ1pkNJThC=xi_0gpWRUb_45eexLH1+k2_Q@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/nbtree/nbtpage.c | modified | +9 −3 |
Discussion
- Using Valgrind to detect faulty buffer accesses (no pin or buffer content lock held) 12 messages · 2020-04-25 → 2020-07-22