xfs: disable xfs_ioc_space for always COW inodes
authorChristoph Hellwig <hch@lst.de>
Fri, 25 Oct 2019 05:26:27 +0000 (22:26 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 28 Oct 2019 23:08:17 +0000 (16:08 -0700)
If we always have to write out of place preallocating blocks is
pointless.  We already check for this in the normal falloc path, but
the check was missig in the legacy ALLOCSP path.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/xfs_ioctl.c

index e897d5363d010748e60259bd95ca72d31ab20692..287f83eb791f5c025f92a2a3ff2d7cfc5dfa57f0 100644 (file)
@@ -33,6 +33,7 @@
 #include "xfs_sb.h"
 #include "xfs_ag.h"
 #include "xfs_health.h"
+#include "xfs_reflink.h"
 
 #include <linux/mount.h>
 #include <linux/namei.h>
@@ -606,6 +607,9 @@ xfs_ioc_space(
        if (!S_ISREG(inode->i_mode))
                return -EINVAL;
 
+       if (xfs_is_always_cow_inode(ip))
+               return -EOPNOTSUPP;
+
        if (filp->f_flags & O_DSYNC)
                flags |= XFS_PREALLOC_SYNC;
        if (filp->f_mode & FMODE_NOCMTIME)