nfsd: don't call functions with side-effecting inside WARN_ON()
authorNeilBrown <neilb@suse.de>
Tue, 30 Jan 2024 01:08:23 +0000 (12:08 +1100)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 1 Mar 2024 14:12:18 +0000 (09:12 -0500)
commitc6540026dfe68b2cc6b6891404f8efa7c40e53e9
tree38909d67173b42b635ffeb01db616e6aa55ae3b0
parent779457285a45cb95d625d407becd6417cb3d1c96
nfsd: don't call functions with side-effecting inside WARN_ON()

Code like:

    WARN_ON(foo())

looks like an assertion and might not be expected to have any side
effects.
When testing if a function with side-effects fails a construct like

    if (foo())
       WARN_ON(1);

makes the intent more obvious.

nfsd has several WARN_ON calls where the test has side effects, so it
would be good to change them.  These cases don't really need the
WARN_ON.  They have never failed in 8 years of usage so let's just
remove the WARN_ON wrapper.

Suggested-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c