linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shea Levy <shea@shealevy.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Shea Levy <shea@shealevy.com>
Subject: [PATCH 1/2] vfs: mountinfo: A mnt is r/o if the superblock is
Date: Thu, 14 Mar 2013 12:09:19 -0400	[thread overview]
Message-ID: <1363277360-1947-2-git-send-email-shea@shealevy.com> (raw)
In-Reply-To: <1363277360-1947-1-git-send-email-shea@shealevy.com>

By calling mount(2) with MS_REMOUNT | MS_BIND on a non-bind readonly
mountpoint, it is possible to have a readonly mount without MNT_READONLY
in its mnt_flags. Currently, /proc/<pid>/mountinfo will report such a
mount as r/w in the 4th column, even though for all intents and purposes
it is still readonly.

This patch makes show_mountinfo use __mnt_is_readonly to check if a
mount is readonly, which checks both for MNT_READONLY in mnt_flags and
for MS_RDONLY in mnt_sb->s_flags.

Signed-off-by: Shea Levy <shea@shealevy.com>
---
 fs/proc_namespace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc_namespace.c b/fs/proc_namespace.c
index 5fe34c3..cf8963c 100644
--- a/fs/proc_namespace.c
+++ b/fs/proc_namespace.c
@@ -143,7 +143,7 @@ static int show_mountinfo(struct seq_file *m, struct vfsmount *mnt)
 	if (err)
 		goto out;
 
-	seq_puts(m, mnt->mnt_flags & MNT_READONLY ? " ro" : " rw");
+	seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
 	show_mnt_opts(m, mnt);
 
 	/* Tagged fields ("foo:X" or "bar") */
-- 
1.8.1.3

  reply	other threads:[~2013-03-14 16:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14 16:09 [PATCH 0/2] vfs: Report a mount r/o if the superblock is Shea Levy
2013-03-14 16:09 ` Shea Levy [this message]
2013-03-14 16:09 ` [PATCH 2/2] vfs: statfs: A fs is " Shea Levy
2013-03-22  1:24 ` [PATCH 0/2] vfs: Report a mount " Shea Levy
2013-04-05 14:06 ` Jan Kara

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=1363277360-1947-2-git-send-email-shea@shealevy.com \
    --to=shea@shealevy.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).