Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1727056
| From | Ross Zwisler <ross.zwisler@linux.intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/9] xfs: always use DAX if mount option is used |
| Date | 2017-09-06 00:40 +0200 |
| Message-ID | <umuFI-AY-9@gated-at.bofh.it> (permalink) |
| References | <umuFH-AY-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The current code has an issue where the user can't reliably tell whether or not DAX is being used to service page faults and I/O when the DAX mount option is used. In this case each inode within the mounted filesystem starts with S_DAX set due to the mount option, but it can be cleared if someone touches the individual inode flag. For example: # mount | grep dax /dev/pmem0 on /mnt type xfs (rw,relatime,seclabel,attr2,dax,inode64,sunit=4096,swidth=4096,noquota) # touch /mnt/a /mnt/b # both files currently use DAX # xfs_io -c "lsattr" /mnt/* # neither has the DAX inode option set ----------e----- /mnt/a ----------e----- /mnt/b # xfs_io -c "chattr -x" /mnt/a # this clears S_DAX for /mnt/a # xfs_io -c "lsattr" /mnt/* ----------e----- /mnt/a ----------e----- /mnt/b We end up with both /mnt/a and /mnt/b looking identical from the point of view of the mount option and from lsattr, but one is using DAX and the other is not. Fix this by always doing DAX I/O when either the mount option is set or when the DAX inode flag is set. This means that DAX will always be used for all inodes on a filesystem mounted with -o dax, making the usage reliable and detectable. Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com> CC: stable@vger.kernel.org --- fs/xfs/xfs_ioctl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 9c0c7a9..8155ddc 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -1008,7 +1008,7 @@ xfs_diflags_to_linux( inode->i_flags |= S_NOATIME; else inode->i_flags &= ~S_NOATIME; - if (xflags & FS_XFLAG_DAX) + if ((xflags & FS_XFLAG_DAX) || (ip->i_mount->m_flags & XFS_MOUNT_DAX)) inode->i_flags |= S_DAX; else inode->i_flags &= ~S_DAX; @@ -1091,7 +1091,14 @@ xfs_ioctl_setattr_dax_invalidate( return -EINVAL; } - /* If the DAX state is not changing, we have nothing to do here. */ + /* + * If the DAX state is not changing, we have nothing to do here. If + * the DAX mount option was used we will update the DAX inode flag as + * the user requested but we will continue to use DAX for I/O and page + * faults regardless of how the inode flag is set. + */ + if (ip->i_mount->m_flags & XFS_MOUNT_DAX) + return 0; if ((fa->fsx_xflags & FS_XFLAG_DAX) && IS_DAX(inode)) return 0; if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode)) -- 2.9.5
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/9] add ext4 per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 9/9] ext4: add per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 2/9] xfs: always use DAX if mount option is used Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 4/9] ext4: add ext4_should_use_dax() Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 8/9] ext4: add sanity check for encryption + DAX Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 5/9] ext4: ext4_change_inode_journal_flag error handling Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
[PATCH 7/9] ext4: prevent data corruption with inline data + DAX Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
Re: [PATCH 7/9] ext4: prevent data corruption with inline data + DAX Andreas Dilger <adilger@dilger.ca> - 2017-09-06 23:00 +0200
Re: [PATCH 7/9] ext4: prevent data corruption with inline data + DAX Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-07 01:20 +0200
[PATCH 1/9] ext4: remove duplicate extended attributes defs Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
Re: [PATCH 1/9] ext4: remove duplicate extended attributes defs Jan Kara <jack@suse.cz> - 2017-09-06 09:30 +0200
[PATCH 6/9] ext4: safely transition S_DAX on journaling changes Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 00:40 +0200
Re: [PATCH 6/9] ext4: safely transition S_DAX on journaling changes Jan Kara <jack@suse.cz> - 2017-09-06 11:50 +0200
Re: [PATCH 6/9] ext4: safely transition S_DAX on journaling changes Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 19:10 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Eric Sandeen <esandeen@redhat.com> - 2017-09-06 04:20 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-06 19:10 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Dan Williams <dan.j.williams@intel.com> - 2017-09-07 23:00 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-07 23:20 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Andreas Dilger <adilger@dilger.ca> - 2017-09-07 23:30 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-08 00:00 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Ross Zwisler <ross.zwisler@linux.intel.com> - 2017-09-08 00:20 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Dave Chinner <david@fromorbit.com> - 2017-09-08 01:30 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Jan Kara <jack@suse.cz> - 2017-09-08 11:50 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Theodore Ts'o <tytso@mit.edu> - 2017-09-08 17:40 +0200
Re: [PATCH 0/9] add ext4 per-inode DAX flag Dave Chinner <david@fromorbit.com> - 2017-09-08 00:20 +0200
csiph-web