super: fix dying superblock warning messages
PATCH 1/1 super: fix dying superblock warning messages
WARN_ON_ONCE() takes a condition, not a message. The string literals are always true, so the warnings still trigger but the messages are never printed.
Use WARN_ONCE(1, ...) instead to print the messages and keep the once-only behavior.
Found with a Coccinelle script. Clang's -Wstring-conversion also flags such calls but is not enabled in kernel builds.
--- fs/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/super.c +2 -2
@@ -2012,7 +2012,7 @@ int freeze_super(struct super_block *sb, enum freeze_holder who, const void *freint ret;if (!super_lock_excl (sb)) { -WARN_ON_ONCE ("Dying superblock while freezing!" ); +WARN_ONCE (1 ,"Dying superblock while freezing!" );return -EINVAL ; }atomic_inc (&sb->s_active);
@@ -2176,7 +2176,7 @@ int thaw_super(struct super_block *sb, enum freeze_holder who, const void *freeze_owner) {if (!super_lock_excl (sb)) { -WARN_ON_ONCE ("Dying superblock while thawing!" ); +WARN_ONCE (1 ,"Dying superblock while thawing!" );return -EINVAL ; }return thaw_super_locked (sb, who, freeze_owner);
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 1 line · Karl Mehltretter
super: fix dying superblock warning messages
Applied to the vfs-7.3.super branch of the vfs/vfs.git tree. Patches in the vfs-7.3.super branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git branch: vfs-7.3.super
[1/1] super: fix dying superblock warning messages
https://git.kernel.org/vfs/vfs/c/9ac8fd831252