From patchwork Mon Jun 13 19:44:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Topi Miettinen X-Patchwork-Id: 9174197 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B82336086B for ; Mon, 13 Jun 2016 19:46:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A5DCD1FF12 for ; Mon, 13 Jun 2016 19:46:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A60426861; Mon, 13 Jun 2016 19:46:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5424820499 for ; Mon, 13 Jun 2016 19:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423813AbcFMTqg (ORCPT ); Mon, 13 Jun 2016 15:46:36 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35372 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423235AbcFMTqd (ORCPT ); Mon, 13 Jun 2016 15:46:33 -0400 Received: by mail-wm0-f67.google.com with SMTP id k184so17288478wme.2; Mon, 13 Jun 2016 12:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gAD+GUTIUQ2UAs44I997CbCF4eQmR6894cdEPa6OqJU=; b=f/1E7qlivzNBr0IQYGjNGjcOM0H/aYwoiB169jYIZKXlsUaywj3CsV1lKcSCq/gxuf qZPOhz0FdrK3hZSFSmE863vVuwQ+0t1Y6OA7zaS4VYoIagQZELXZvp5/U0xiHrxN8rF/ U0ktG5ow+eKjyEyhGtdnbcNCHqpMEl+5PwGnfCRy4ucjP99HTRPUVo/y2Mp6tcodtP9w 9i1CbCjzQDFq0yFP9nWKuzUN7RFjFIaajxuVfS8zOVptcHxqj1pNLQ9HWzulNDMzHcUU KZtOEGrRYh2SvKAKdB2uYjBQatBv4TociXBLsfAHnVQ/Me4YnDBlnY2P2KytO5mXpLrW zR0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gAD+GUTIUQ2UAs44I997CbCF4eQmR6894cdEPa6OqJU=; b=AiFkX506H3efE+9XJ1W+FfzM4iwJtQtoPVjNuR3gtNBtY+Lck2EWFefk3BvqeoCgUy nf6MtcusUszmEhN6vJjB83MpUb5s1mWEpbbq9vjY1mGXAAlOv1XTg7pn/PtsFN0RUHdA Cx4/kMlp7Ux2CXNcU5Bj/mv/ddTUnzAEpz5SjS2PLjvVPytjK3SlgTUnnGTV1PZJgng9 vr8yisWtGQB6JGqFKrY02bb2a2RKMOa1/UEH0gJIJAPm04cWEv2Rz3N2kQAHgiftuvQ5 YZxVB6Y4rQm/ZXUQcOAqidBGOd5yqSShfrOo+jHoHCfSzGjC6CPkpR9/1IXNY7XzuzgR QXzQ== X-Gm-Message-State: ALyK8tLNgWj9F5K7liCh7KUXEEfYwM0ztjMZwk/vgf+jx7XQA0pa+B3PQRpvrZUycJ5i3w== X-Received: by 10.194.235.4 with SMTP id ui4mr2858953wjc.23.1465847192114; Mon, 13 Jun 2016 12:46:32 -0700 (PDT) Received: from localhost.localdomain ([2001:2003:f54a:b700:2ab2:bdff:fe10:799e]) by smtp.gmail.com with ESMTPSA id c9sm29135737wjh.49.2016.06.13.12.46.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jun 2016 12:46:31 -0700 (PDT) From: Topi Miettinen To: linux-kernel@vger.kernel.org Cc: Topi Miettinen , Alexander Viro , Andrew Morton , Jan Kara , Johannes Weiner , Michal Hocko , Ross Zwisler , "Kirill A. Shutemov" , Mel Gorman , Junichi Nomura , Matthew Wilcox , linux-fsdevel@vger.kernel.org (open list:FILESYSTEMS (VFS and infrastructure)), linux-mm@kvack.org (open list:MEMORY MANAGEMENT) Subject: [RFC 07/18] limits: track RLIMIT_FSIZE actual max Date: Mon, 13 Jun 2016 22:44:14 +0300 Message-Id: <1465847065-3577-8-git-send-email-toiwoton@gmail.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1465847065-3577-1-git-send-email-toiwoton@gmail.com> References: <1465847065-3577-1-git-send-email-toiwoton@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Track maximum file size, presented in /proc/self/limits. Signed-off-by: Topi Miettinen --- fs/attr.c | 2 ++ mm/filemap.c | 1 + 2 files changed, 3 insertions(+) diff --git a/fs/attr.c b/fs/attr.c index 25b24d0..1b620f7 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -116,6 +116,8 @@ int inode_newsize_ok(const struct inode *inode, loff_t offset) return -ETXTBSY; } + bump_rlimit(RLIMIT_FSIZE, offset); + return 0; out_sig: send_sig(SIGXFSZ, current, 0); diff --git a/mm/filemap.c b/mm/filemap.c index 00ae878..1fa9864 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2447,6 +2447,7 @@ inline ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from) send_sig(SIGXFSZ, current, 0); return -EFBIG; } + bump_rlimit(RLIMIT_FSIZE, iocb->ki_pos); iov_iter_truncate(from, limit - (unsigned long)pos); }