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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux