Message ID | 20170830155517.GI4757@magnolia (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
How about returning an error from xfs_set_diflags for anything that would go into di_flags2 for v2 inodes? -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, Aug 30, 2017 at 09:15:00AM -0700, Christoph Hellwig wrote: > How about returning an error from xfs_set_diflags for > anything that would go into di_flags2 for v2 inodes? I had also thought about refactoring all those xfs_ioctl_setattr_xflags validity checks into a single separate checking function, how about that? --D > -- > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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.
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(+) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html