Remove obsolete locking comment from AddBufferToRing()
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.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
The following review has been posted through the commitfest application:
make installcheck-world: not tested
Implements feature: not tested
Spec compliant: not tested
Documentation: tested, passed
Hello,
This comment patching looks good to me.
Regards,
PF
The new status of this patch is: Ready for Committer
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
On Nov 5, 2026, at 23:10, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
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
Thanks for pushing.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/