nilfs2: switch WARN_ONs to warning output in nilfs_sufile_do_free()
Ryusuke Konishi
maintainerPATCH 1/1 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().
Signed-off-by Ryusuke Konishi <[email protected]>
---
Andrew, please add this to the queue for the next merge window. This replaces two potentially triggered WARN_ONs with ones that use a warning output macro.
Thanks,
Ryusuke Konishi
fs/nilfs2/sufile.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
fs/nilfs2/sufile.c +7 -2
@@ -471,10 +471,15 @@ void nilfs_sufile_do_free(struct inode *sufile, __u64 segnum,kunmap_atomic (kaddr);return ; } -WARN_ON (nilfs_segment_usage_error (su)); -WARN_ON (!nilfs_segment_usage_dirty (su)); +if (unlikely (nilfs_segment_usage_error (su))) +nilfs_warn (sufile->i_sb,"free segment %llu marked in error" , + (unsigned long long )segnum); sudirty =nilfs_segment_usage_dirty (su); +if (unlikely (!sudirty)) +nilfs_warn (sufile->i_sb,"free unallocated segment %llu" , + (unsigned long long )segnum); +nilfs_segment_usage_set_clean (su);kunmap_atomic (kaddr);mark_buffer_dirty (su_bh);
Signature · 1 line
2.34.1