| To: | linux-fsdevel@xxxxxxxxxxxxxxx |
|---|---|
| Subject: | [PATCH 2/4] fs: Prevent doing FALLOC_FL_ZERO_RANGE on append only file |
| From: | Lukas Czerner <lczerner@xxxxxxxxxx> |
| Date: | Fri, 11 Apr 2014 20:57:43 +0200 |
| Cc: | linux-ext4@xxxxxxxxxxxxxxx, xfs@xxxxxxxxxxx, ceph-devel@xxxxxxxxxxxxxxx, Lukas Czerner <lczerner@xxxxxxxxxx> |
| Delivered-to: | xfs@xxxxxxxxxxx |
| In-reply-to: | <1397242665-2183-1-git-send-email-lczerner@xxxxxxxxxx> |
| References: | <1397242665-2183-1-git-send-email-lczerner@xxxxxxxxxx> |
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.
Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx>
---
fs/open.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/open.c b/fs/open.c
index 631aea81..7882ff5 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -254,10 +254,11 @@ int do_fallocate(struct file *file, int mode, loff_t
offset, loff_t len)
return -EBADF;
/*
- * It's not possible to punch hole or perform collapse range
- * on append only file
+ * It's not possible to punch hole, perform collapse range
+ * or zero range on append only file
*/
- if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE)
+ if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
+ FALLOC_FL_ZERO_RANGE)
&& IS_APPEND(inode))
return -EPERM;
--
1.8.3.1
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 3/4] fs: Remove i_size check from do_fallocate, Lukas Czerner |
|---|---|
| Next by Date: | [PATCH 4/4] fs: Disallow all fallocate operation on active swapfile, Lukas Czerner |
| Previous by Thread: | Re: [PATCH 3/4] fs: Remove i_size check from do_fallocate, LukÃÅ Czerner |
| Next by Thread: | Re: [PATCH 2/4] fs: Prevent doing FALLOC_FL_ZERO_RANGE on append only file, Theodore Ts'o |
| Indexes: | [Date] [Thread] [Top] [All Lists] |