From: Jeff Layton <jlayton@redhat.com>
To: Carlos Maiolino <cmaiolino@redhat.com>, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] Make statfs properly return read-only state after emergency remount
Date: Thu, 29 Jun 2017 11:56:36 -0400 [thread overview]
Message-ID: <1498751796.22569.9.camel@redhat.com> (raw)
In-Reply-To: <20170629092540.7813-1-cmaiolino@redhat.com>
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>
prev parent reply other threads:[~2017-06-29 15:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1498751796.22569.9.camel@redhat.com \
--to=jlayton@redhat.com \
--cc=cmaiolino@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).