On 16/10/2026 11:10, Chao Li wrote:
Hi,
While working on another patch, I spotted this stale comment on
AddBufferToRing():
```
/*
* AddBufferToRing -- add a buffer to the buffer ring
*
* Caller must hold the buffer header spinlock on the buffer. Since this
* is called with the spinlock held, it had better be quite cheap.
*/
static void
AddBufferToRing(BufferAccessStrategy strategy, BufferDesc *buf)
```
It says the caller must hold the buffer header spinlock, but this is no longer
true. The only caller of AddBufferToRing() is StrategyGetBuffer(), which pins
the buffer without acquiring the buffer header lock.
This seems to be an oversight in 5e899859287. The commit explicitly removed
buffer header locking from StrategyGetBuffer() and updated its comment as:
```
- * To ensure that no one else can pin the buffer before we do, we must
- * return the buffer with the buffer header spinlock still held.
+ * It is the callers responsibility to ensure the buffer ownership can be
+ * tracked via TrackNewBufferPin().
```
In the attached patch, I just deleted the stale paragraph without adding
anything.
Committed, thanks
- Heikki