From patchwork Thu Jun 29 09:25:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Maiolino X-Patchwork-Id: 9816283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE7B56035F for ; Thu, 29 Jun 2017 09:25:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4C5A28653 for ; Thu, 29 Jun 2017 09:25:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A97D8286E5; Thu, 29 Jun 2017 09:25:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55B8C28653 for ; Thu, 29 Jun 2017 09:25:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751646AbdF2JZq (ORCPT ); Thu, 29 Jun 2017 05:25:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42984 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbdF2JZp (ORCPT ); Thu, 29 Jun 2017 05:25:45 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4BB5642BCE for ; Thu, 29 Jun 2017 09:25:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4BB5642BCE Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=cmaiolino@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4BB5642BCE Received: from eorzea.usersys.redhat.com (ovpn-204-57.brq.redhat.com [10.40.204.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id B326A7899F for ; Thu, 29 Jun 2017 09:25:44 +0000 (UTC) From: Carlos Maiolino To: linux-fsdevel@vger.kernel.org Subject: [PATCH] Make statfs properly return read-only state after emergency remount Date: Thu, 29 Jun 2017 11:25:40 +0200 Message-Id: <20170629092540.7813-1-cmaiolino@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 29 Jun 2017 09:25:45 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Emergency remount (sysrq-u) sets MS_RDONLY to the superblock but doesn't set MNT_READONLY to the mount point. Once calculate_f_flags() only check for the mount point read only state, when setting kstatfs flags, after an emergency remount, statfs does not report the filesystem as read-only, even though it is. Enable flags_by_sb() to also check for superblock read only state, so the kstatfs and consequently statfs can properly show the read-only state of the filesystem. Signed-off-by: Carlos Maiolino Reviewed-by: Jeff Layton --- fs/statfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/statfs.c b/fs/statfs.c index 4e4623c..c1dfc37 100644 --- a/fs/statfs.c +++ b/fs/statfs.c @@ -38,6 +38,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; }