public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: xfs <linux-xfs@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@infradead.org>
Subject: [PATCH] xfs: don't set DAX flag for v2 inodes
Date: Wed, 30 Aug 2017 08:55:17 -0700	[thread overview]
Message-ID: <20170830155517.GI4757@magnolia> (raw)

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 <darrick.wong@oracle.com>
---
 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.

             reply	other threads:[~2017-08-30 15:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-30 15:55 Darrick J. Wong [this message]
2017-08-30 16:15 ` [PATCH] xfs: don't set DAX flag for v2 inodes Christoph Hellwig
2017-08-30 16:22   ` Darrick J. Wong
2017-08-30 16:38 ` [PATCH v2] xfs: don't set v3 xflags " Darrick J. Wong
2017-08-31 13:17   ` Christoph Hellwig
2017-08-31 13:34     ` Brian Foster
2017-08-31 14:06       ` Christoph Hellwig
2017-08-31 14:09       ` Christoph Hellwig
2017-08-31 14:17         ` Brian Foster
2017-08-31 19:57         ` Darrick J. Wong
2017-09-01  7:21           ` Christoph Hellwig
2017-09-01 17:52             ` Darrick J. Wong
2017-09-01 19:29               ` Christoph Hellwig
2017-09-01 19:40                 ` Darrick J. Wong
2017-09-01 20:06                   ` Darrick J. Wong
2017-09-01 20:08                     ` Christoph Hellwig
2017-08-31 13:35   ` Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170830155517.GI4757@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=jack@suse.cz \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox