summaryrefslogtreecommitdiff
path: root/fs/nilfs2
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@gmail.com>2024-05-09 01:14:29 +0300
committerAndrew Morton <akpm@linux-foundation.org>2024-05-12 01:51:44 +0300
commit0a73eac1ed10097d1799c10dff2172605fd40c75 (patch)
treee64076d31795400083f8aee785cde6355227047c /fs/nilfs2
parentb1be5844c1a0124a49a30a20a189d0a53aa10578 (diff)
downloadlinux-0a73eac1ed10097d1799c10dff2172605fd40c75.tar.xz
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>
Diffstat (limited to 'fs/nilfs2')
-rw-r--r--fs/nilfs2/recovery.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c
index e48372618ac4..020f304c600e 100644
--- a/fs/nilfs2/recovery.c
+++ b/fs/nilfs2/recovery.c
@@ -699,7 +699,9 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
return;
bh = __getblk(nilfs->ns_bdev, ri->ri_lsegs_start, nilfs->ns_blocksize);
- BUG_ON(!bh);
+ if (WARN_ON(!bh))
+ return; /* should never happen */
+
memset(bh->b_data, 0, bh->b_size);
set_buffer_dirty(bh);
err = sync_dirty_buffer(bh);