aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/open.c b/fs/open.c
index 4197b9ed023d..5b6ef7e2859e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -223,7 +223,12 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
223 return -EINVAL; 223 return -EINVAL;
224 224
225 /* Return error if mode is not supported */ 225 /* Return error if mode is not supported */
226 if (mode && !(mode & FALLOC_FL_KEEP_SIZE)) 226 if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
227 return -EOPNOTSUPP;
228
229 /* Punch hole must have keep size set */
230 if ((mode & FALLOC_FL_PUNCH_HOLE) &&
231 !(mode & FALLOC_FL_KEEP_SIZE))
227 return -EOPNOTSUPP; 232 return -EOPNOTSUPP;
228 233
229 if (!(file->f_mode & FMODE_WRITE)) 234 if (!(file->f_mode & FMODE_WRITE))