* [PATCH 0/2] vfs: Report a mount r/o if the superblock is
@ 2013-03-14 16:09 Shea Levy
2013-03-14 16:09 ` [PATCH 1/2] vfs: mountinfo: A mnt is " Shea Levy
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Shea Levy @ 2013-03-14 16:09 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel, linux-kernel; +Cc: Shea Levy
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 and statfs will
report such a mount as r/w, even though for all intents and purposes it
is still readonly.
This patchset fixes show_mountinfo and statfs to report such mounts as
readonly.
Signed-off-by: Shea Levy <shea@shealevy.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] vfs: mountinfo: A mnt is r/o if the superblock is
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
2013-03-14 16:09 ` [PATCH 2/2] vfs: statfs: A fs " Shea Levy
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Shea Levy @ 2013-03-14 16:09 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel, linux-kernel; +Cc: Shea Levy
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] vfs: statfs: A fs is r/o if the superblock is
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 ` [PATCH 1/2] vfs: mountinfo: A mnt is " Shea Levy
@ 2013-03-14 16:09 ` Shea Levy
2013-03-22 1:24 ` [PATCH 0/2] vfs: Report a mount " Shea Levy
2013-04-05 14:06 ` Jan Kara
3 siblings, 0 replies; 5+ messages in thread
From: Shea Levy @ 2013-03-14 16:09 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel, linux-kernel; +Cc: Shea Levy
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, statfs will not set the ST_RDONLY flag in
f_flags for such a mount, even though for all intents and purposes it is
still readonly.
This patch makes vfs_statfs set ST_RDONLY in f_flags if mnt_sb->s_flags
contains MS_RDONLY.
Signed-off-by: Shea Levy <shea@shealevy.com>
---
fs/statfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/statfs.c b/fs/statfs.c
index c219e733..c614087 100644
--- a/fs/statfs.c
+++ b/fs/statfs.c
@@ -37,6 +37,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;
}
--
1.8.1.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] vfs: Report a mount r/o if the superblock is
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 ` [PATCH 1/2] vfs: mountinfo: A mnt is " Shea Levy
2013-03-14 16:09 ` [PATCH 2/2] vfs: statfs: A fs " Shea Levy
@ 2013-03-22 1:24 ` Shea Levy
2013-04-05 14:06 ` Jan Kara
3 siblings, 0 replies; 5+ messages in thread
From: Shea Levy @ 2013-03-22 1:24 UTC (permalink / raw)
To: Alexander Viro, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Shea Levy
Any feedback on this?
On Mar 14, 2013, at 12:09 PM, Shea Levy <shea@shealevy.com> wrote:
> 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 and statfs will
> report such a mount as r/w, even though for all intents and purposes it
> is still readonly.
>
> This patchset fixes show_mountinfo and statfs to report such mounts as
> readonly.
>
> Signed-off-by: Shea Levy <shea@shealevy.com>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] vfs: Report a mount r/o if the superblock is
2013-03-14 16:09 [PATCH 0/2] vfs: Report a mount r/o if the superblock is Shea Levy
` (2 preceding siblings ...)
2013-03-22 1:24 ` [PATCH 0/2] vfs: Report a mount " Shea Levy
@ 2013-04-05 14:06 ` Jan Kara
3 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2013-04-05 14:06 UTC (permalink / raw)
To: Shea Levy; +Cc: Alexander Viro, linux-fsdevel, linux-kernel, Andrew Morton
On Thu 14-03-13 12:09:18, Shea Levy wrote:
> 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 and statfs will
> report such a mount as r/w, even though for all intents and purposes it
> is still readonly.
>
> This patchset fixes show_mountinfo and statfs to report such mounts as
> readonly.
Andrew, I think the two patches in this thread deserve to be picked up...
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-05 14:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 1/2] vfs: mountinfo: A mnt is " Shea Levy
2013-03-14 16:09 ` [PATCH 2/2] vfs: statfs: A fs " Shea Levy
2013-03-22 1:24 ` [PATCH 0/2] vfs: Report a mount " Shea Levy
2013-04-05 14:06 ` Jan Kara
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).