Skip to content

Commit 0a73eac

Browse files
konisakpm00
authored andcommitted
nilfs2: convert BUG_ON() in nilfs_finish_roll_forward() to WARN_ON()
The BUG_ON check performed on the return value of __getblk() in nilfs_finish_roll_forward() assumes that a buffer that has been successfully read once is retrieved with the same parameters and does not fail (__getblk() does not return an error due to memory allocation failure). Also, nilfs_finish_roll_forward() is called at most once during mount. Taking these into consideration, rewrite the check to use WARN_ON() to avoid using BUG_ON(). Link: https://lkml.kernel.org/r/20240508221429.7559-1-konishi.ryusuke@gmail.com Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent b1be584 commit 0a73eac

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nilfs2/recovery.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,9 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
699699
return;
700700

701701
bh = __getblk(nilfs->ns_bdev, ri->ri_lsegs_start, nilfs->ns_blocksize);
702-
BUG_ON(!bh);
702+
if (WARN_ON(!bh))
703+
return; /* should never happen */
704+
703705
memset(bh->b_data, 0, bh->b_size);
704706
set_buffer_dirty(bh);
705707
err = sync_dirty_buffer(bh);

0 commit comments

Comments
 (0)