Clear ref_blkno output when block is already dirty - #315
Open
aversecat wants to merge 1 commit into
Open
Conversation
zabbo
requested changes
Jun 22, 2026
aversecat
force-pushed
the
auke/clear_ref_blkno_dirty
branch
from
July 1, 2026 17:07
9ab925b to
c9d442c
Compare
scoutfs_block_dirty_ref() only sets *ref_blkno on the path that allocates a new cow block. The early return paths leave it untouched, so a caller that reads it back gets whatever value was on the stack. This is harmless with the current callers. dirty_alloc_blocks() bails out before calling here when the blocks are already dirty, so the early return on an already-dirty block is never reached, and the error paths return a negative value that callers check before using ref_blkno. Signed-off-by: Auke Kok <auke.kok@versity.com>
aversecat
force-pushed
the
auke/clear_ref_blkno_dirty
branch
from
August 13, 2026 17:53
c9d442c to
e2ee720
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
block_dirty_ref() skipped setting *ref_blkno when the block was already dirty, leaving the caller with a stale value passed by reference.
dirty_alloc_blocks() calls it twice but when the referenced block is already dirty, it will receive the uninitialized stack value back, and then adding it freed list with list_block_add() later.
Set it to 0 on the already-dirty fast path so callers do not try to free a random block.