From 0a80704c608af28cfddb726f83ef32247e00d23e 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 8602f18c..5999681d 100644 --- a/kmod/src/block.c +++ b/kmod/src/block.c @@ -838,6 +838,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; }