gfs2: replace WARN_ON_ONCE with fs_warn in rgblk_free
PATCH 1/1 gfs2: replace WARN_ON_ONCE with fs_warn in rgblk_free
From: Tristan Madani <[email protected]>
rgblk_free() triggers WARN_ON_ONCE when gfs2_rbm_from_block() fails due to a block number outside the resource group bounds. This can be triggered by a corrupted filesystem image, causing unnecessary kernel warnings.
Replace WARN_ON_ONCE with fs_warn() to provide a more informative diagnostic message while avoiding the kernel warning.
Reported-by [email protected]
Fixes 5b924ae2b7b4 ("GFS2: fix rgrp end rounding problem for bsize < page size")
Signed-off-by Tristan Madani <[email protected]>
--- fs/gfs2/rgrp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/gfs2/rgrp.c +4 -1
@@ -2266,8 +2266,11 @@ static void rgblk_free(struct gfs2_sbd *sdp, struct gfs2_rgrpd *rgd,struct gfs2_bitmap *bi, *bi_prev =NULL ; rbm.rgd = rgd; -if (WARN_ON_ONCE (gfs2_rbm_from_block (&rbm, bstart))) +if (gfs2_rbm_from_block (&rbm, bstart)) { +fs_warn (sdp,"rgblk_free: block %llu outside rgrp\n" , + (unsigned long long )bstart);return ; + }while (blen--) { bi =rbm_bi (&rbm);if (bi != bi_prev) {
Signature · 1 line
2.47.3