Instrument buffer head reaper and add deferred reclaim queue#3
Instrument buffer head reaper and add deferred reclaim queue#3
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| InsertTailList(&Vcb->bd.bd_bh_deferred, &bh->b_link); | ||
|
|
||
| if (busy) { | ||
| break; |
There was a problem hiding this comment.
Detaching busy buffer heads while dropping VCB
When Ext2DropBH sees a buffer head with a non‑zero b_count, it now re‑queues the node onto bd_bh_deferred and breaks out of the loop. Ext2DestroyVcb frees bd_bh_lock, the buffer‑head slab cache, and eventually the VCB itself immediately after calling Ext2DropBH, so any busy buffer head left on bd_bh_deferred keeps list links and lock pointers that refer to freed memory. If the last reference to that buffer is released later (e.g. via __brelse), the code will acquire a deleted resource and run RemoveEntryList against the stale list head, risking a crash. The previous implementation detached busy entries by reinitializing the list head so delayed release was harmless. The drop routine should either keep busy entries detached or delay VCB teardown until the deferred list drains.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68fcbf19346083338e47737dc3926c22