From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukas Czerner Subject: [PATCH 2/3 v2] fs: Prevent doing FALLOC_FL_ZERO_RANGE on append only file Date: Tue, 15 Apr 2014 18:41:15 +0200 Message-ID: <1397580076-19826-2-git-send-email-lczerner@redhat.com> References: <1397580076-19826-1-git-send-email-lczerner@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: Lukas Czerner , linux-ext4@vger.kernel.org, xfs@oss.sgi.com To: linux-fsdevel@vger.kernel.org Return-path: In-Reply-To: <1397580076-19826-1-git-send-email-lczerner@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: xfs-bounces@oss.sgi.com Sender: xfs-bounces@oss.sgi.com List-Id: linux-ext4.vger.kernel.org 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: Lukas Czerner --- v2: Change the condition to be future proof as suggested by hch fs/open.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/open.c b/fs/open.c index 631aea81..fe48b2f 100644 --- a/fs/open.c +++ b/fs/open.c @@ -254,11 +254,9 @@ 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 + * We can only allow pure fallocate on append only files */ - if (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE) - && IS_APPEND(inode)) + if (mode & ~FALLOC_FL_KEEP_SIZE && IS_APPEND(inode)) return -EPERM; if (IS_IMMUTABLE(inode)) -- 1.8.3.1 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs