Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD465C282DA for ; Wed, 17 Apr 2019 20:04:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B445221773 for ; Wed, 17 Apr 2019 20:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732105AbfDQUE5 (ORCPT ); Wed, 17 Apr 2019 16:04:57 -0400 Received: from out30-133.freemail.mail.aliyun.com ([115.124.30.133]:53104 "EHLO out30-133.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfDQUE5 (ORCPT ); Wed, 17 Apr 2019 16:04:57 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=bo.liu@linux.alibaba.com;NM=1;PH=DS;RN=2;SR=0;TI=SMTPD_---0TPaTROi_1555531488; Received: from localhost(mailfrom:bo.liu@linux.alibaba.com fp:SMTPD_---0TPaTROi_1555531488) by smtp.aliyun-inc.com(127.0.0.1); Thu, 18 Apr 2019 04:04:48 +0800 From: Liu Bo To: linux-fsdevel@vger.kernel.org Cc: Miklos Szeredi Subject: [PATCH] Fuse: honor RLIMIT_FSIZE in fuse_file_fallocate Date: Thu, 18 Apr 2019 04:04:41 +0800 Message-Id: <20190417200441.90291-2-bo.liu@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.2.gb21ebb6 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org fstests generic/228 reported this failure that fuse fallocate does not honor what 'ulimit -f' has set. This adds the necessary inode_newsize_ok() check. Signed-off-by: Liu Bo --- fs/fuse/file.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 44e76b00e985..7c9bfeff0dd2 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -3051,6 +3051,13 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset, } } + if (!(mode & FALLOC_FL_KEEP_SIZE) && + offset + length > i_size_read(inode)) { + err = inode_newsize_ok(inode, offset + length); + if (err) + return err; + } + if (!(mode & FALLOC_FL_KEEP_SIZE)) set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); -- 2.20.1.2.gb21ebb6