[PATCH] bfs: mark buffer uptodate before mark_buffer_dirty in bfs_move_block
From: Jiakai Xu
Date: Fri May 08 2026 - 02:08:39 EST
bfs_move_block() calls sb_getblk() to get a buffer for the destination
block, then copies the data via memcpy(). However, it never calls
set_buffer_uptodate() on the new buffer before calling
mark_buffer_dirty(), which triggers:
WARN_ON_ONCE(!buffer_uptodate(bh))
in mark_buffer_dirty(). Add the missing set_buffer_uptodate() call
after copying the data, matching the pattern used by other filesystems
(e.g., ext2) when initializing new buffers obtained via sb_getblk().
Signed-off-by: Jiakai Xu <xujiakai24@xxxxxxxxxxxxxxxx>
---
fs/bfs/file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/bfs/file.c b/fs/bfs/file.c
index d33d6bde992b..0aeeeb3db8b2 100644
--- a/fs/bfs/file.c
+++ b/fs/bfs/file.c
@@ -41,6 +41,7 @@ static int bfs_move_block(unsigned long from, unsigned long to,
return -EIO;
new = sb_getblk(sb, to);
memcpy(new->b_data, bh->b_data, bh->b_size);
+ set_buffer_uptodate(new);
mark_buffer_dirty(new);
bforget(bh);
brelse(new);
--
2.34.1