* [PATCH] Make statfs properly return read-only state after emergency remount
@ 2017-06-29 9:25 Carlos Maiolino
2017-06-29 15:56 ` Jeff Layton
0 siblings, 1 reply; 2+ messages in thread
From: Carlos Maiolino @ 2017-06-29 9:25 UTC (permalink / raw)
To: linux-fsdevel
Emergency remount (sysrq-u) sets MS_RDONLY to the superblock but doesn't set
MNT_READONLY to the mount point.
Once calculate_f_flags() only check for the mount point read only state,
when setting kstatfs flags, after an emergency remount, statfs does not
report the filesystem as read-only, even though it is.
Enable flags_by_sb() to also check for superblock read only state, so the
kstatfs and consequently statfs can properly show the read-only state of
the filesystem.
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
fs/statfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/statfs.c b/fs/statfs.c
index 4e4623c..c1dfc37 100644
--- a/fs/statfs.c
+++ b/fs/statfs.c
@@ -38,6 +38,8 @@ static int flags_by_sb(int s_flags)
flags |= ST_SYNCHRONOUS;
if (s_flags & MS_MANDLOCK)
flags |= ST_MANDLOCK;
+ if (s_flags & MS_RDONLY)
+ flags |= ST_RDONLY;
return flags;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Make statfs properly return read-only state after emergency remount
2017-06-29 9:25 [PATCH] Make statfs properly return read-only state after emergency remount Carlos Maiolino
@ 2017-06-29 15:56 ` Jeff Layton
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Layton @ 2017-06-29 15:56 UTC (permalink / raw)
To: Carlos Maiolino, linux-fsdevel
On Thu, 2017-06-29 at 11:25 +0200, Carlos Maiolino wrote:
> Emergency remount (sysrq-u) sets MS_RDONLY to the superblock but doesn't set
> MNT_READONLY to the mount point.
>
> Once calculate_f_flags() only check for the mount point read only state,
> when setting kstatfs flags, after an emergency remount, statfs does not
> report the filesystem as read-only, even though it is.
>
> Enable flags_by_sb() to also check for superblock read only state, so the
> kstatfs and consequently statfs can properly show the read-only state of
> the filesystem.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> fs/statfs.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/statfs.c b/fs/statfs.c
> index 4e4623c..c1dfc37 100644
> --- a/fs/statfs.c
> +++ b/fs/statfs.c
> @@ -38,6 +38,8 @@ static int flags_by_sb(int s_flags)
> flags |= ST_SYNCHRONOUS;
> if (s_flags & MS_MANDLOCK)
> flags |= ST_MANDLOCK;
> + if (s_flags & MS_RDONLY)
> + flags |= ST_RDONLY;
> return flags;
> }
>
IIUC, the superblock won't be writeable once MS_RDONLY is set, so every
mount that uses it also becomes readonly regardless of how MNT_READONLY
is set. LGTM:
Reviewed-by: Jeff Layton <jlayton@redhat.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-29 15:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 9:25 [PATCH] Make statfs properly return read-only state after emergency remount Carlos Maiolino
2017-06-29 15:56 ` Jeff Layton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.