ext4: on a remount, only log the ro or r/w state when it has changed

[ Upstream commit d7b0befd09320e3356a75cb96541c030515e7f5f ]

A user complained that a message such as:

EXT4-fs (nvme0n1p3): re-mounted UUID ro. Quota mode: none.

implied that the file system was previously mounted read/write and was
now remounted read-only, when it could have been some other mount
state that had changed by the "mount -o remount" operation.  Fix this
by only logging "ro"or "r/w" when it has changed.

https://bugzilla.kernel.org/show_bug.cgi?id=219132

Signed-off-by: Nicolas Bretz <bretznic@gmail.com>
Link: https://patch.msgid.link/20250319171011.8372-1-bretznic@gmail.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Nicolas Bretz
2025-03-19 11:10:11 -06:00
committed by Greg Kroah-Hartman
parent 44acbc14ea
commit f29eb4c63b

View File

@@ -6771,6 +6771,7 @@ static int ext4_reconfigure(struct fs_context *fc)
{ {
struct super_block *sb = fc->root->d_sb; struct super_block *sb = fc->root->d_sb;
int ret; int ret;
bool old_ro = sb_rdonly(sb);
fc->s_fs_info = EXT4_SB(sb); fc->s_fs_info = EXT4_SB(sb);
@@ -6782,9 +6783,9 @@ static int ext4_reconfigure(struct fs_context *fc)
if (ret < 0) if (ret < 0)
return ret; return ret;
ext4_msg(sb, KERN_INFO, "re-mounted %pU %s. Quota mode: %s.", ext4_msg(sb, KERN_INFO, "re-mounted %pU%s.",
&sb->s_uuid, sb_rdonly(sb) ? "ro" : "r/w", &sb->s_uuid,
ext4_quota_mode(sb)); (old_ro != sb_rdonly(sb)) ? (sb_rdonly(sb) ? " ro" : " r/w") : "");
return 0; return 0;
} }