]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/open.c
Merge tag 'xfs-reflink-for-linus-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kerne...
[mirror_ubuntu-artful-kernel.git] / fs / open.c
index a7719cfb7257e9b19b2ff50efeb5366f98f4d24b..d3ed8171e8e09291b44524e6de943bc3e71c91e3 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -267,6 +267,11 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
            (mode & ~FALLOC_FL_INSERT_RANGE))
                return -EINVAL;
 
+       /* Unshare range should only be used with allocate mode. */
+       if ((mode & FALLOC_FL_UNSHARE_RANGE) &&
+           (mode & ~(FALLOC_FL_UNSHARE_RANGE | FALLOC_FL_KEEP_SIZE)))
+               return -EINVAL;
+
        if (!(file->f_mode & FMODE_WRITE))
                return -EBADF;