lkml.org 
[lkml]   [2013]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] vfs: mountinfo: A mnt is r/o if the superblock is
Date
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


\
 
 \ /
  Last update: 2013-03-14 17:44    [W:0.086 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site