Commit 8fc61d92 authored by Lukas Czerner's avatar Lukas Czerner Committed by Theodore Ts'o

fs: prevent doing FALLOC_FL_ZERO_RANGE on append only file

Currently punch hole and collapse range fallocate operation are not
allowed on append only file. This should be case for zero range as well.
Fix it by allowing only pure fallocate (possibly with keep size set).
Signed-off-by: default avatarLukas Czerner <lczerner@redhat.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 9ef06cec
...@@ -254,11 +254,9 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) ...@@ -254,11 +254,9 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
return -EBADF; return -EBADF;
/* /*
* It's not possible to punch hole or perform collapse range * We can only allow pure fallocate on append only files
* on append only file
*/ */
if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE) if ((mode & ~FALLOC_FL_KEEP_SIZE) && IS_APPEND(inode))
&& IS_APPEND(inode))
return -EPERM; return -EPERM;
if (IS_IMMUTABLE(inode)) if (IS_IMMUTABLE(inode))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment