Clear ref_blkno output when block is already dirty

block_dirty_ref() skipped setting *ref_blkno when the block was
already dirty, leaving the caller with a stale value.  Set it to 0
on the already-dirty fast path so callers do not try to free a
block that was not allocated.

Signed-off-by: Auke Kok <auke.kok@versity.com>
This commit is contained in:
Auke Kok
2026-04-15 12:06:42 -07:00
parent ff1d800985
commit e4b6840a85

View File

@@ -846,6 +846,8 @@ int scoutfs_block_dirty_ref(struct super_block *sb, struct scoutfs_alloc *alloc,
bp = BLOCK_PRIVATE(bl);
if (block_is_dirty(bp)) {
if (ref_blkno)
*ref_blkno = 0;
ret = 0;
goto out;
}