From patchwork Sat Sep 2 22:41:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Wareing X-Patchwork-Id: 9935839 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 824F4603B5 for ; Sat, 2 Sep 2017 22:42:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B68428681 for ; Sat, 2 Sep 2017 22:42:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EE322868F; Sat, 2 Sep 2017 22:42:26 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 BD94428682 for ; Sat, 2 Sep 2017 22:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752786AbdIBWmC (ORCPT ); Sat, 2 Sep 2017 18:42:02 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:49250 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752785AbdIBWmC (ORCPT ); Sat, 2 Sep 2017 18:42:02 -0400 Received: from pps.filterd (m0001303.ppops.net [127.0.0.1]) by m0001303.ppops.net (8.16.0.21/8.16.0.21) with SMTP id v82McQo5027287 for ; Sat, 2 Sep 2017 15:42:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fb.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=J6PYMiLui48gMWLg8QzTaZoFpiYXrp9fKZfsse/+0Io=; b=rnkxx2Kr2fxpJMBUcYOX3HBk3LSBwxs/p0/ZzbyND3ms/SoSsiLvGUJMCabSzsJxGeXp Mc/+f6pv+FSjkvWYScBS9ZktC1TODWrqzeL2gA7GX06dLLr4EOIqoJlfWWwP+wZFDaf4 X1bURK0vXyWVY4j+pEVth/C6AXTOUTd5o5w= Received: from mail.thefacebook.com ([199.201.64.23]) by m0001303.ppops.net with ESMTP id 2cqrafs9yr-4 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 02 Sep 2017 15:42:01 -0700 Received: from mx-out.facebook.com (192.168.52.123) by PRN-CHUB13.TheFacebook.com (192.168.16.23) with Microsoft SMTP Server id 14.3.319.2; Sat, 2 Sep 2017 15:42:00 -0700 X-ThriftRelayHost: devbig279.prn1.facebook.com Received: from devbig279.prn1.facebook.com (localhost [127.0.0.1]) by devbig279.prn1.facebook.com (Postfix) with ESMTP id 5E3913620A73; Sat, 2 Sep 2017 15:41:59 -0700 (PDT) Smtp-Origin-Hostprefix: devbig From: Richard Wareing Smtp-Origin-Hostname: devbig279.prn1.facebook.com To: CC: Richard Wareing , , Smtp-Origin-Cluster: prn1c29 Subject: [PATCH v2 1/3] fs/xfs: Add rtdisable option Date: Sat, 2 Sep 2017 15:41:43 -0700 Message-ID: <20170902224145.1291030-2-rwareing@fb.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170902224145.1291030-1-rwareing@fb.com> References: <20170902224145.1291030-1-rwareing@fb.com> X-FB-Internal: Safe MIME-Version: 1.0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-09-02_08:, , signatures=0 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Adds rtdisable mount option to ignore any real-time inheritance flag set on directories. Designed to be used as a "kill-switch" for this behavior, negating the need to walk/kill flags on FS. Signed-off-by: Richard Wareing --- fs/xfs/xfs_inode.c | 6 ++++-- fs/xfs/xfs_ioctl.c | 7 +++++-- fs/xfs/xfs_mount.h | 1 + fs/xfs/xfs_super.c | 14 +++++++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index ec9826c..dc53731 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -878,7 +878,8 @@ xfs_ialloc( uint di_flags = 0; if (S_ISDIR(mode)) { - if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) + if (!(mp->m_flags & XFS_MOUNT_RTDISABLE) && + pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) di_flags |= XFS_DIFLAG_RTINHERIT; if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { di_flags |= XFS_DIFLAG_EXTSZINHERIT; @@ -887,7 +888,8 @@ xfs_ialloc( if (pip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) di_flags |= XFS_DIFLAG_PROJINHERIT; } else if (S_ISREG(mode)) { - if (pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) + if (!(mp->m_flags & XFS_MOUNT_RTDISABLE) && + pip->i_d.di_flags & XFS_DIFLAG_RTINHERIT) di_flags |= XFS_DIFLAG_REALTIME; if (pip->i_d.di_flags & XFS_DIFLAG_EXTSZINHERIT) { di_flags |= XFS_DIFLAG_EXTSIZE; diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 6190697..5a6d45d 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -937,6 +937,7 @@ xfs_set_diflags( struct xfs_inode *ip, unsigned int xflags) { + struct xfs_mount *mp = ip->i_mount; unsigned int di_flags; uint64_t di_flags2; @@ -957,7 +958,8 @@ xfs_set_diflags( if (xflags & FS_XFLAG_FILESTREAM) di_flags |= XFS_DIFLAG_FILESTREAM; if (S_ISDIR(VFS_I(ip)->i_mode)) { - if (xflags & FS_XFLAG_RTINHERIT) + if (!(mp->m_flags & XFS_MOUNT_RTDISABLE) && + xflags & FS_XFLAG_RTINHERIT) di_flags |= XFS_DIFLAG_RTINHERIT; if (xflags & FS_XFLAG_NOSYMLINKS) di_flags |= XFS_DIFLAG_NOSYMLINKS; @@ -966,7 +968,8 @@ xfs_set_diflags( if (xflags & FS_XFLAG_PROJINHERIT) di_flags |= XFS_DIFLAG_PROJINHERIT; } else if (S_ISREG(VFS_I(ip)->i_mode)) { - if (xflags & FS_XFLAG_REALTIME) + if (!(mp->m_flags & XFS_MOUNT_RTDISABLE) && + xflags & FS_XFLAG_REALTIME) di_flags |= XFS_DIFLAG_REALTIME; if (xflags & FS_XFLAG_EXTSIZE) di_flags |= XFS_DIFLAG_EXTSIZE; diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index 9fa312a..8016ddb 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -243,6 +243,7 @@ typedef struct xfs_mount { allocator */ #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */ +#define XFS_MOUNT_RTDISABLE (1ULL << 61) /* Ignore RT flags */ #define XFS_MOUNT_DAX (1ULL << 62) /* TEST ONLY! */ diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 455a575..4dbf95c 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -83,7 +83,7 @@ enum { Opt_quota, Opt_noquota, Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_uquota, Opt_gquota, Opt_pquota, Opt_uqnoenforce, Opt_gqnoenforce, Opt_pqnoenforce, Opt_qnoenforce, - Opt_discard, Opt_nodiscard, Opt_dax, Opt_err, + Opt_discard, Opt_nodiscard, Opt_dax, Opt_rtdisable, Opt_err, }; static const match_table_t tokens = { @@ -133,6 +133,9 @@ static const match_table_t tokens = { {Opt_dax, "dax"}, /* Enable direct access to bdev pages */ +#ifdef CONFIG_XFS_RT + {Opt_rtdisable, "rtdisable"}, /* Ignore real-time flags */ +#endif /* Deprecated mount options scheduled for removal */ {Opt_barrier, "barrier"}, /* use writer barriers for log write and * unwritten extent conversion */ @@ -367,6 +370,11 @@ xfs_parseargs( case Opt_nodiscard: mp->m_flags &= ~XFS_MOUNT_DISCARD; break; +#ifdef CONFIG_XFS_RT + case Opt_rtdisable: + mp->m_flags |= XFS_MOUNT_RTDISABLE; + break; +#endif #ifdef CONFIG_FS_DAX case Opt_dax: mp->m_flags |= XFS_MOUNT_DAX; @@ -492,6 +500,10 @@ xfs_showargs( { XFS_MOUNT_DISCARD, ",discard" }, { XFS_MOUNT_SMALL_INUMS, ",inode32" }, { XFS_MOUNT_DAX, ",dax" }, +#ifdef CONFIG_XFS_RT + { XFS_MOUNT_RTDISABLE, ",rtdisable" }, +#endif + { 0, NULL } }; static struct proc_xfs_info xfs_info_unset[] = {