public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
Cc: agruenba@redhat.com, gfs2@lists.linux.dev,
	linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linux.dev,
	david.hunter.linux@gmail.com, khalid@kernel.org,
	syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com
Subject: Re: [PATCH] gfs2: replace BUG_ON with WARN_ON_ONCE in gfs2_quota_cleanup
Date: Fri, 28 Nov 2025 07:07:04 +0100	[thread overview]
Message-ID: <2025112811-endorse-unclothed-a989@gregkh> (raw)
In-Reply-To: <20251127193247.17030-1-ssrane_b23@ee.vjti.ac.in>

On Fri, Nov 28, 2025 at 01:02:47AM +0530, Shaurya Rane wrote:
> gfs2_quota_cleanup() triggers a kernel BUG when called while the
> journal is still marked live and SDF_NORECOVERY is not set. This
> can occur during filesystem withdraw or error recovery paths,
> particularly via gfs2_make_fs_ro() during a reconfigure operation.
> 
> The BUG_ON was intended to catch unexpected state where quota
> cleanup runs while the journal is active. However, the cleanup
> code is safe in this scenario because it skips quota entries with
> active references and waits for all references to drain via
> wait_event_timeout().
> 
> Crashing the kernel is unnecessarily harsh for what is a
> recoverable situation. Replace the BUG_ON with WARN_ON_ONCE to
> flag the unexpected state for debugging while allowing the
> cleanup to proceed safely.
> 
> Reported-by: syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=af4d53576692f8956fd6
> Fixes: 71733b492200 ("gfs2: fix kernel BUG in gfs2_quota_cleanup")
> Signed-off-by: Shaurya Rane <ssrane_b23@ee.vjti.ac.in>
> ---
>  fs/gfs2/quota.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
> index 2298e06797ac..13f113d8aaef 100644
> --- a/fs/gfs2/quota.c
> +++ b/fs/gfs2/quota.c
> @@ -1516,8 +1516,8 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
>  	LIST_HEAD(dispose);
>  	int count;
>  
> -	BUG_ON(!test_bit(SDF_NORECOVERY, &sdp->sd_flags) &&
> -		test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags));
> +	WARN_ON_ONCE(!test_bit(SDF_NORECOVERY, &sdp->sd_flags) &&
> +		     test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags));

You still just rebooted the box if this ever happens (remember
panic-on-warn is enabled on a few billion Linux systems.)

Please fix the root problem here, if this can happen, check it, properly
recover from it, and return the error.  Don't just paper over the issue
like this, this is not a fix at all.

thanks,

greg k-h

      reply	other threads:[~2025-11-28  6:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 19:32 [PATCH] gfs2: replace BUG_ON with WARN_ON_ONCE in gfs2_quota_cleanup Shaurya Rane
2025-11-28  6:07 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2025112811-endorse-unclothed-a989@gregkh \
    --to=greg@kroah.com \
    --cc=agruenba@redhat.com \
    --cc=david.hunter.linux@gmail.com \
    --cc=gfs2@lists.linux.dev \
    --cc=khalid@kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=ssrane_b23@ee.vjti.ac.in \
    --cc=syzbot+af4d53576692f8956fd6@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox