filesystems_thaw() is called on every resume from suspend or hibernation no matter whether filesystem freezing was enabled. It walks all superblocks that have freeze methods and calls thaw_super() with FREEZE_EXCL | FREEZE_HOLDER_KERNEL and its owner token. It relies on may_unfreeze() to refuse every superblock it didn't freeze itself. But may_unfreeze() checks the kernel freeze count before it checks whether the superblock is exclusively frozen at all. A superblock that userspace froze via FIFREEZE or that got frozen through its block device has freeze_kcount == 0. So every resume while such a filesystem is frozen triggers: WARNING: fs/super.c:2165 at thaw_super_locked+0x85f/0xbf0 ... filesystems_thaw_callback+0x196/0x220 and with panic_on_warn the resume panics. Check the owner first. If the superblock isn't exclusively frozen, or not by the caller, there's nothing for the caller to undo and that isn't a bug. An exclusive freeze always holds a kernel reference so keep warning if that's not the case. Reproducer, needs CONFIG_PM_DEBUG: mount /dev/sda /mnt fsfreeze --freeze /mnt echo freezer > /sys/power/pm_test echo freeze > /sys/power/state # WARNING in thaw_super_locked() from filesystems_thaw_callback() It fires on every run. Not a selftest because it suspends the machine and the only symptom is the warning in the kernel log. Fixes: 1af3331764b9 ("super: add filesystem freezing helpers for suspend and hibernate") Cc: stable@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) --- fs/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/super.c b/fs/super.c index 15ecfbeb92ab..4e8f7f48540c 100644 --- a/fs/super.c +++ b/fs/super.c @@ -2165,14 +2165,15 @@ static inline bool may_unfreeze(struct super_block *sb, enum freeze_holder who, return false; if (WARN_ON_ONCE(!freeze_owner)) return false; - if (WARN_ON_ONCE(sb->s_writers.freeze_kcount == 0)) - return false; /* This isn't exclusively frozen. */ if (!sb->s_writers.freeze_owner) return false; /* This isn't exclusively frozen by us. */ if (sb->s_writers.freeze_owner != freeze_owner) return false; + /* An exclusive freeze always holds a kernel reference. */ + if (WARN_ON_ONCE(sb->s_writers.freeze_kcount == 0)) + return false; /* * This is still frozen multiple times so we're just * going to drop our reference count and undo our -- 2.53.0