From e4b6840a8536efd2ef9c8299069fe310c7082375 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 15 Apr 2026 12:06:42 -0700 Subject: [PATCH] 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 --- kmod/src/block.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kmod/src/block.c b/kmod/src/block.c index 5ad81377..fcb6a64c 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -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; }