Add ext4_file_write() rework series
[ext4-patch-queue.git] / prevent-doing-ZERO-RANGE-on-append-only-file
blobd47d0b9e911b34f2d957e41d55e0bde837b07a90
1 fs: prevent doing FALLOC_FL_ZERO_RANGE on append only file
3 From: Lukas Czerner <lczerner@redhat.com>
5 Currently punch hole and collapse range fallocate operation are not
6 allowed on append only file. This should be case for zero range as well.
7 Fix it.
9 Signed-off-by: Lukas Czerner <lczerner@redhat.com>
10 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
11 ---
12  fs/open.c | 7 ++++---
13  1 file changed, 4 insertions(+), 3 deletions(-)
15 diff --git a/fs/open.c b/fs/open.c
16 index 631aea81..7882ff5 100644
17 --- a/fs/open.c
18 +++ b/fs/open.c
19 @@ -254,10 +254,11 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
20                 return -EBADF;
22         /*
23 -        * It's not possible to punch hole or perform collapse range
24 -        * on append only file
25 +        * It's not possible to punch hole, perform collapse range
26 +        * or zero range on append only file
27          */
28 -       if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE)
29 +       if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
30 +                   FALLOC_FL_ZERO_RANGE)
31             && IS_APPEND(inode))
32                 return -EPERM;
34 -- 
35 1.8.3.1
38 To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
39 the body of a message to majordomo@vger.kernel.org
40 More majordomo info at  http://vger.kernel.org/majordomo-info.html