From patchwork Fri Feb 16 17:04:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 10225137 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 488C7601E7 for ; Fri, 16 Feb 2018 17:04:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3808B295FF for ; Fri, 16 Feb 2018 17:04:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C6B729604; Fri, 16 Feb 2018 17:04:29 +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=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B644F295FF for ; Fri, 16 Feb 2018 17:04:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 757B2223230F9; Fri, 16 Feb 2018 08:58:34 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=dave.jiang@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EDFFA223230D7 for ; Fri, 16 Feb 2018 08:58:32 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 09:04:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,520,1511856000"; d="scan'208";a="20719851" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by fmsmga002.fm.intel.com with ESMTP; 16 Feb 2018 09:04:26 -0800 Subject: [PATCH v6 3/3] xfs: reject removal of realtime flag when datadev doesn't support DAX From: Dave Jiang To: darrick.wong@oracle.com Date: Fri, 16 Feb 2018 10:04:26 -0700 Message-ID: <151880066614.43131.15847174332875373188.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <151880058592.43131.558230052922233871.stgit@djiang5-desk3.ch.intel.com> References: <151880058592.43131.558230052922233871.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org, david@fromorbit.com, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In a situation where the rt_dev is DAX and data_dev is not DAX, if the user requests to remove the realtime flag via ioctl we can no longer support DAX for that file. Dynamic changing of S_DAX on the inode is not supported due to various complications in the existing implementation. Therefore until we address the dynamic S_DAX change issues, we must disallow realtime flag being removed. Signed-off-by: Dave Jiang Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_ioctl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 2c70a0a4f59f..edd97d527fe8 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1030,6 +1030,20 @@ xfs_ioctl_setattr_xflags( { struct xfs_mount *mp = ip->i_mount; uint64_t di_flags2; + struct inode *inode = VFS_I(ip); + struct super_block *sb = inode->i_sb; + + /* + * In the case that the inode is realtime, and we are trying to remove + * the realtime flag, and the rtdev supports DAX but the datadev does + * not support DAX, we can't allow the realtime flag to be removed + * since we do not support dynamic S_DAX flag removal yet. + */ + if (XFS_IS_REALTIME_INODE(ip) && + !(fa->fsx_xflags & FS_XFLAG_REALTIME) && + bdev_dax_supported(mp->m_rtdev_targp->bt_bdev, sb->s_blocksize) && + !bdev_dax_supported(mp->m_ddev_targp->bt_bdev, sb->s_blocksize)) + return -ENOTSUPP; /* Can't change realtime flag if any extents are allocated. */ if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&