From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1805C4332F for ; Tue, 8 Nov 2022 13:31:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 34C006B0073; Tue, 8 Nov 2022 08:31:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FBFD6B0074; Tue, 8 Nov 2022 08:31:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A2306B0075; Tue, 8 Nov 2022 08:31:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0ABB06B0073 for ; Tue, 8 Nov 2022 08:31:06 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id A5CD9A0DB4 for ; Tue, 8 Nov 2022 13:31:05 +0000 (UTC) X-FDA: 80110360890.10.AFB377E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf12.hostedemail.com (Postfix) with ESMTP id 460DF4000C for ; Tue, 8 Nov 2022 13:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667914264; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=wetjxKkRrm9+E5qgVzNgI7+QzQNhg3aa53td2i6Cwss=; b=iVSkpvD3AKHgdrlTagnWepjejqADM2uNUt6866zy83D3MySM5iVemqeOCIVPgiGP4v9nAD fruDvLkZWCVw8XFWZbj8ZwoZQ/XIdL8s3pB9hF71KR5OlJoSm8QTq0XAEY+RK0yo3330He /1oI1+aODF84YcdkYLeqJVTQGTTkwq8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-90-_qc74EkWNrax99J06F70pA-1; Tue, 08 Nov 2022 08:30:20 -0500 X-MC-Unique: _qc74EkWNrax99J06F70pA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 54659381A72A; Tue, 8 Nov 2022 13:30:20 +0000 (UTC) Received: from ovpn-194-7.brq.redhat.com (ovpn-194-7.brq.redhat.com [10.40.194.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A12A40C6FA3; Tue, 8 Nov 2022 13:30:19 +0000 (UTC) From: Lukas Czerner To: Hugh Dickins Cc: Jan Kara , Eric Sandeen , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 0/2] [RFC] shmem: user and group quota support for tmpfs Date: Tue, 8 Nov 2022 14:30:08 +0100 Message-Id: <20221108133010.75226-1-lczerner@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667914265; a=rsa-sha256; cv=none; b=5xFr90zG4JHcdVeORJzBOP/kWCRvmuP6L18bdJ1z+Cl+Mzo4nfh6WY2ff4SrrbEZMVhVo4 61E0WWCItVljMMqv8uvePjcZL508vOSqFe8p0y1E1Brh4lMQJ5Sqkj0yvSl1lws4dItErJ YOaTFrbm7qnOJrC1jzXZtunswfb0xhs= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iVSkpvD3; spf=pass (imf12.hostedemail.com: domain of lczerner@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=lczerner@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667914265; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=wetjxKkRrm9+E5qgVzNgI7+QzQNhg3aa53td2i6Cwss=; b=KVloz1zUl48PMoxT+21GYR0Rr0XKWSBOXOeLEqbRFnZVLfWGXufi4m9HUIhJ0NKD8Wv+7j RUTQ1LJVx/vUJrf3vbnX1eWz2ICsMcdWLrQdScsa0z/XcSBvHeTFW0S2ZZ+qr/JlBSrPn7 LXCLBXXB+4SGabQG4LZNDhbFOZ0F69w= Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=iVSkpvD3; spf=pass (imf12.hostedemail.com: domain of lczerner@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=lczerner@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 460DF4000C X-Stat-Signature: t6sbc1eewd8br67axysbrpuh9qqs9sr5 X-HE-Tag: 1667914264-652387 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: people have been asking for quota support in tmpfs many times in the past mostly to avoid one malicious user, or misbehaving user/program to consume all of the system memory. This has been partially solved with the size mount option, but some problems still prevail. One of the problems is the fact that /dev/shm is still generally unprotected with this and another is administration overhead of managing multiple tmpfs mounts and lack of more fine grained control. Quota support can solve all these problems in a somewhat standard way people are already familiar with from regular file systems. It can give us more fine grained control over how much memory user/groups can consume. Additionally it can also control number of inodes and with special quota mount options introduced with a second patch we can set global limits allowing us to replace the size mount option with quota entirely. Currently the standard userspace quota tools (quota, xfs_quota) are only using quotactl ioctl which is expecting a block device. I patched quota [1] and xfs_quota [2] to use quotactl_fd in case we want to run the tools on mount point directory to work nicely with tmpfs. The implementation was tested on patched version of xfstests [3]. Thoughts? -Lukas [1] https://github.com/lczerner/quota/tree/quotactl_fd_support [2] https://github.com/lczerner/xfsprogs/tree/quotactl_fd_support [3] https://github.com/lczerner/xfstests/tree/tmpfs_quota_support