From patchwork Fri Feb 9 00:38:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 10208173 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 1520060236 for ; Fri, 9 Feb 2018 00:38:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0392C296ED for ; Fri, 9 Feb 2018 00:38:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC3B329719; Fri, 9 Feb 2018 00:38:27 +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 A12D4296ED for ; Fri, 9 Feb 2018 00:38:27 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EC9292237A4D7; Thu, 8 Feb 2018 16:32:41 -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.24; helo=mga09.intel.com; envelope-from=dave.jiang@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 E93C3222DE126 for ; Thu, 8 Feb 2018 16:32:39 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2018 16:38:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,481,1511856000"; d="scan'208";a="25999345" Received: from djiang5-desk3.ch.intel.com ([143.182.136.93]) by FMSMGA003.fm.intel.com with ESMTP; 08 Feb 2018 16:38:24 -0800 Subject: [PATCH v3 3/3] xfs: reject removal of realtime flag when datadev doesn't support DAX From: Dave Jiang To: darrick.wong@oracle.com Date: Thu, 08 Feb 2018 17:38:24 -0700 Message-ID: <151813670468.15926.3966047346830424677.stgit@djiang5-desk3.ch.intel.com> In-Reply-To: <151813659955.15926.8922476613392258086.stgit@djiang5-desk3.ch.intel.com> References: <151813659955.15926.8922476613392258086.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 --- fs/xfs/xfs_ioctl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index e440d789ed1b..cd5a5c61da39 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1029,6 +1029,21 @@ 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(sb, mp->m_rtdev_targp->bt_bdev, + sb->s_blocksize) && + !bdev_dax_supported(sb, 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) &&