[PATCH 2/2] vfs: statfs: A fs is r/o if the superblock is

From: Shea Levy
Date: Thu Mar 14 2013 - 12:11:26 EST


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@xxxxxxxxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/