public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: xfs@oss.sgi.com
Cc: ross.zwisler@linux.intel.com, jack@suse.cz
Subject: [PATCH 1/4] xfs: XFS_DIFLAG_DAX is only for regular files or directories
Date: Mon, 15 Feb 2016 16:22:11 +1100	[thread overview]
Message-ID: <1455513734-15192-2-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1455513734-15192-1-git-send-email-david@fromorbit.com>

From: Dave Chinner <dchinner@redhat.com>

Only file data can use DAX, so we should onyl be able to set this
flag on regular files. However, the flag also serves as an "inherit"
flag at file create time when set on directories, so limit the
FS_IOC_FSSETXATTR ioctl to only set this flag on regular files and
directories.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
 fs/xfs/xfs_ioctl.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 81d6d62..0895967 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1051,6 +1051,14 @@ xfs_ioctl_setattr_xflags(
 	    !capable(CAP_LINUX_IMMUTABLE))
 		return -EPERM;
 
+	/*
+	 * It is only valid to set the DAX flag on regular files and
+	 * directories. On directories it serves as an inherit hint.
+	 */
+	if ((fa->fsx_xflags & FS_XFLAG_DAX) &&
+	    !(S_ISREG(VFS_I(ip)->i_mode) || S_ISDIR(VFS_I(ip)->i_mode)))
+		return -EINVAL;
+
 	xfs_set_diflags(ip, fa->fsx_xflags);
 	xfs_diflags_to_linux(ip);
 	xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
-- 
2.5.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2016-02-15  5:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15  5:22 [PATCH 0/4] xfs: fixes for XFS_DIFLAG2_DAX support Dave Chinner
2016-02-15  5:22 ` Dave Chinner [this message]
2016-02-15  5:22 ` [PATCH 2/4] xfs: S_DAX is only for regular files Dave Chinner
2016-02-15  5:22 ` [PATCH 3/4] xfs: dynamically switch modes when XFS_DIFLAG2_DAX is set/cleared Dave Chinner
2016-02-17  7:31   ` [PATCH 3/4 v2] " Dave Chinner
2016-02-17 20:57     ` Ross Zwisler
2016-02-15  5:22 ` [PATCH 4/4] xfs: XFS_DIFLAG2_DAX limited by PAGE_SIZE Dave Chinner
2016-02-16  0:12   ` Eric Sandeen
2016-02-16  0:39     ` Dave Chinner
2016-02-16  0:54       ` Eric Sandeen
2016-02-16 23:53 ` [PATCH 0/4] xfs: fixes for XFS_DIFLAG2_DAX support Ross Zwisler
2016-02-17  0:23   ` Dave Chinner
2016-02-17 20:04 ` Brian Foster
2016-02-17 22:56 ` Ross Zwisler

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=1455513734-15192-2-git-send-email-david@fromorbit.com \
    --to=david@fromorbit.com \
    --cc=jack@suse.cz \
    --cc=ross.zwisler@linux.intel.com \
    --cc=xfs@oss.sgi.com \
    /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