Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nilfs2: switch WARN_ONs to warning output in nilfs_sufile_do_free()

nilfs_sufile_do_free(), which is called when log write fails or during GC,
uses WARN_ONs to check for abnormal status of metadata. In the former
case, these WARN_ONs will not be fired, but in the latter case they don't
"never-happen". It is possible to trigger these by intentionally
modifying the userland GC library to release segments that are not in the
expected state.

So, replace them with warning output using the dedicated macro
nilfs_warn().

This replaces two potentially triggered WARN_ONs with ones that use a
warning output macro.

Link: https://lkml.kernel.org/r/20231207045730.5205-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Ryusuke Konishi and committed by
Andrew Morton
2c20b0f2 6915f40c

+7 -2
+7 -2
fs/nilfs2/sufile.c
··· 471 471 kunmap_atomic(kaddr); 472 472 return; 473 473 } 474 - WARN_ON(nilfs_segment_usage_error(su)); 475 - WARN_ON(!nilfs_segment_usage_dirty(su)); 474 + if (unlikely(nilfs_segment_usage_error(su))) 475 + nilfs_warn(sufile->i_sb, "free segment %llu marked in error", 476 + (unsigned long long)segnum); 476 477 477 478 sudirty = nilfs_segment_usage_dirty(su); 479 + if (unlikely(!sudirty)) 480 + nilfs_warn(sufile->i_sb, "free unallocated segment %llu", 481 + (unsigned long long)segnum); 482 + 478 483 nilfs_segment_usage_set_clean(su); 479 484 kunmap_atomic(kaddr); 480 485 mark_buffer_dirty(su_bh);