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: 871167 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zcx4g1B8Vz9s7M for ; Fri, 9 Feb 2018 11:38:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752422AbeBIAi0 (ORCPT ); Thu, 8 Feb 2018 19:38:26 -0500 Received: from mga01.intel.com ([192.55.52.88]:38682 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752409AbeBIAiZ (ORCPT ); Thu, 8 Feb 2018 19:38:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.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 Cc: linux-nvdimm@lists.01.org, david@fromorbit.com, linux-xfs@vger.kernel.org, ross.zwisler@linux.intel.com, linux-ext4@vger.kernel.org, dan.j.williams@intel.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 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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) &&