From: Shea Levy Subject: [PATCH 2/2] vfs: statfs: A fs is r/o if the superblock is Date: Thu, 14 Mar 2013 12:09:20 -0400 Message-ID: <1363277360-1947-3-git-send-email-shea@shealevy.com> References: <1363277360-1947-1-git-send-email-shea@shealevy.com> Cc: Shea Levy To: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Return-path: Received: from hapkido.dreamhost.com ([66.33.216.122]:50349 "EHLO hapkido.dreamhost.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932473Ab3CNQLG (ORCPT ); Thu, 14 Mar 2013 12:11:06 -0400 Received: from homiemail-a46.g.dreamhost.com (caibbdcaaaaf.dreamhost.com [208.113.200.5]) by hapkido.dreamhost.com (Postfix) with ESMTP id DCCEFDEECF for ; Thu, 14 Mar 2013 09:11:03 -0700 (PDT) In-Reply-To: <1363277360-1947-1-git-send-email-shea@shealevy.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 --- 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