From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:51464 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751415AbdH3P5y (ORCPT ); Wed, 30 Aug 2017 11:57:54 -0400 Date: Wed, 30 Aug 2017 08:55:17 -0700 From: "Darrick J. Wong" Subject: [PATCH] xfs: don't set DAX flag for v2 inodes Message-ID: <20170830155517.GI4757@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-xfs-owner@vger.kernel.org List-ID: List-Id: xfs To: xfs Cc: Jan Kara , Christoph Hellwig The DAX flag can only be persisted for v3 inodes, so don't allow users to set the flag on older filesystems. Signed-off-by: Darrick J. Wong --- fs/xfs/xfs_ioctl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 9c0c7a9..fa17f89 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1043,6 +1043,10 @@ xfs_ioctl_setattr_xflags( if ((fa->fsx_xflags & FS_XFLAG_DAX) && xfs_is_reflink_inode(ip)) return -EINVAL; + /* Don't allow us to set DAX mode for a non-v3 inode. */ + if ((fa->fsx_xflags & FS_XFLAG_DAX) && ip->i_d.di_version < 3) + return -EINVAL; + /* * Can't modify an immutable/append-only file unless * we have appropriate permission.