From f99d8e9c4cd714c5612b4a60cb1ae1afbbef1248 Mon Sep 17 00:00:00 2001 From: Suraj Sonawane Date: Mon, 25 Nov 2024 00:38:47 +0530 Subject: [PATCH] fix WARNING in minix_unlink syz test Signed-off-by: Suraj Sonawane --- fs/minix/bitmap.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index 7da66ca18..18c6fe544 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c @@ -60,11 +60,15 @@ void minix_free_block(struct inode *inode, unsigned long block) } bh = sbi->s_zmap[zone]; spin_lock(&bitmap_lock); - if (!minix_test_and_clear_bit(bit, bh->b_data)) + if (minix_test_and_clear_bit(bit, bh->b_data)) { + /* Proceed only if the bit was set */ + mark_buffer_dirty(bh); + } else { printk("minix_free_block (%s:%lu): bit already cleared\n", sb->s_id, block); + } + spin_unlock(&bitmap_lock); - mark_buffer_dirty(bh); return; } -- 2.34.1