Re: [GIT PULL] fscrypt fix for v6.3-rc4

From: Theodore Ts'o
Date: Mon Mar 20 2023 - 22:03:42 EST


On Mon, Mar 20, 2023 at 03:59:34PM -0700, Eric Biggers wrote:
>
> Yes, I agree that most of the WARN_ONs should be WARN_ON_ONCEs. I think I've
> been assuming that WARN_ON is significantly more lightweight than WARN_ON_ONCE.
> But that doesn't seem to be the case, especially since commit 19d436268dde
> ("debug: Add _ONCE() logic to report_bug()").

Another option is WARN_RATELIMITED.

As an unrelated side-note, one of the things I've been working on in
some of the ext4 code paths when I've been moving BUG_ON's to
WARN_RATELIMITED is to think about what might be needed to debug a
problem, and sometimes it can be helpful to use a printf string to
provide more context than just a WARN_ON.

Cheers,

- Ted