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 1AA72C77B7F for ; Wed, 17 May 2023 10:51:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A92D8900005; Wed, 17 May 2023 06:51:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A4212900003; Wed, 17 May 2023 06:51:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E377900005; Wed, 17 May 2023 06:51:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7F9DE900003 for ; Wed, 17 May 2023 06:51:05 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 3A14CC04E7 for ; Wed, 17 May 2023 10:51:05 +0000 (UTC) X-FDA: 80799429690.21.4DAF55B Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf16.hostedemail.com (Postfix) with ESMTP id 4F047180007 for ; Wed, 17 May 2023 10:51:03 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=pJzVo6K6; spf=pass (imf16.hostedemail.com: domain of hughd@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684320663; a=rsa-sha256; cv=none; b=DZjb6NNuj6KJ9otlVHuZp9veVCCb9Bjf+mtGgu+stTsqpue47pPQXWkRPY+QmFYAYs5Y4Q T6g1R5I/dRM35lzwF8wc3KHuwX26P//TJLVaQ0fGmG16zVJpiuGM3oC4bUM96ZRCOj97Bb OgOGor7+bc1dMgWlv7scjCO1YRyA1vs= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=pJzVo6K6; spf=pass (imf16.hostedemail.com: domain of hughd@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684320663; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7Gw/nFgM66W0F1hY4dIi8SPI28fmRbulPvC24clCLJA=; b=2cvAzry4lye3KABtwR6yOJR8Y+zMAer4jnBLJARFbk6EnaA/3O6siWkst+BKxSCd7xkjTG qW8OIsHPMTMVFn4mIcnwFQUfDkPSjxwA1FgNwDE4dITY1jX806uajy1R8JbmvyhsXax7y0 dLWNezXKG7uiLFzBpJnc/0BlrMJ+Lz4= Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-b9246a5f3feso832014276.1 for ; Wed, 17 May 2023 03:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684320662; x=1686912662; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=7Gw/nFgM66W0F1hY4dIi8SPI28fmRbulPvC24clCLJA=; b=pJzVo6K67r/UjoBgbbGrnyKigA7vtgWFvU0DJ8IkMVQoZNXk0Lp+VJDL1iIYpd81Fc OKtvFy7VHXpoI9aCRITXtzueOFOyU8q2O8+ArD/oa6dhUfMPTKVhaH1hnN51fY7COCb9 f3cthPAJeMzsrWZqamoYpdzz0SHmWO8mtr6x++Df3bGqczuaadpmB+WGDaKY7dRngvYG aaFupDNxm+++nsfhpyMl5cIvL87fZoQUqHGeVYkoyg9bGoLX5iXIFl6PWpcewvXp92Ki ZxHqIKBDhWkoRUiJpS9uAL7gzaJFsWzySZi3LS0iOPMIAhP7cjZwEW7KRrbJsgeq+IGC H++A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684320662; x=1686912662; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7Gw/nFgM66W0F1hY4dIi8SPI28fmRbulPvC24clCLJA=; b=NMyQHIKc94MKS1XT3Nqtf3cjAeEOfp0RgrWs2XMSpAOXWzLuhrfSJTKzN+ThUYYSs8 Wb91raJTt0be7F9b7cq7j//6N8ppCajndSZVbpU2ibcQQH74jkGRoC+erTmXaMYr+tnw ujppBPv0/TYOZwK3SeAD5bNXI+0MaDFznnLpz4nifKW9/ex/Nj/DF6ymoZ8H4BCz30Us 5eyAhOf8GH4ro8I3H4SPAUWRmM9EevD/lgqHVN5bi5KICTlZEzdz4DLbLsZsp611XJDC Gyq7vrDZ+KI73uzXamlRAhy6kxGJS8bZL2Vrt27vWY2Oqfu4nx9uiNOeIfL3VfHYGk3D 82Gg== X-Gm-Message-State: AC+VfDya4WC/FlSGRrCnnMw8TUxvuDPiIWaRV0uWu50PNuMnRUgPlaGu BfDQ+rtulvueOZ4eD2+rUjEkaw== X-Google-Smtp-Source: ACHHUZ7RC+7ZD3UcS0XihTT69tZ7H6BUD9A9plffuHCSn5RjytFWbP+Ilr0C4BpxW7Qc/TJ90Woxow== X-Received: by 2002:a25:6801:0:b0:b9e:453e:d0c4 with SMTP id d1-20020a256801000000b00b9e453ed0c4mr35279378ybc.28.1684320662248; Wed, 17 May 2023 03:51:02 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 67-20020a250f46000000b00b9d8612a8bbsm478874ybp.16.2023.05.17.03.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 03:51:01 -0700 (PDT) Date: Wed, 17 May 2023 03:50:47 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Carlos Maiolino cc: Andrew Morton , Christian Brauner , hughd@google.com, jack@suse.cz, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, djwong@kernel.org Subject: Re: [PATCH V4 0/6] shmem: Add user and group quota support for tmpfs In-Reply-To: <20230515085439.5s5n4xxljgl6e5jl@andromeda> Message-ID: References: <20230426102008.2930932-1-cem@kernel.org> <20230515085439.5s5n4xxljgl6e5jl@andromeda> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspam-User: X-Stat-Signature: mewez3wxwepwjpfi8wfrziqtwcjb1s1f X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4F047180007 X-HE-Tag: 1684320663-200220 X-HE-Meta: U2FsdGVkX1+m6XfglEODMgc1dEbUziCFkWK3U+qoIzEpgjSSlagB+AX5gzrxIuBRujnlj5g2kg34qTTLMdqB7hsCsx+IPGCencAjFu6E2kpFWUbgdWRg4WVN1FR9UYueKPWbRoANFquH2h7HJ2b9LX5iwmpq9oLsQr0jVHXKK1azbipv+Nsp3J1istn/q2/1QW4XWryHLpuvX0KlZ+AsKOf8th04qcPSJvzHu1sd2u8oorD5qtZ/1U3X1MB/Dhf2g+nqF+nKrm/YVOQqq2ejr9MBU79v/txlkAj+VmetxnyL9DBEEo646ncGqC58hk+ZnyTyZbD4XvyKMxIcu+TtERpf3hK8eAMsRj/IB96Zrrw7Nnl73G2qQGdRh+dyd9sWpm6Mxub1e0ZhO6/tYcjH9psMkvLwaE5XImQo6iUuhw5f00PmJMYke9vqSw9uEa+syIK2b1RHfZ5kqx/gNqPjBxdqIscUMmzhKEVLAyPgAo3CWOfY7RmZeLqdEKC1+u/nD3cBdND6/tmYzumhFZRKMONNOtFX3mIHcGOG7+2WmSq7R7dhtN9KYWMJrd17QRbCf8VSk+fUbmV/ztF2PMkJKACGtmgsd9Og9KQhfc2G2sMnc2Q3oX4Ek71p06qhr3hb6dg1Szo+srR6KJqcetUFenEak1IiXmkTSZL/qo+wi9XEYOk/V7b0cN01TP9dVp+3pGLBrwoT9m/itf+y0G6Xp5ov6NTi6sP/KNOHUSKemHwdhL5GlstXINbBu8J2hSwchkYQj4FpIcF0OpBQTkh12z1VA898XHgLEIOqjGtgqlxex29L5gkdiU5swRiqJLzna/wBF8j0SxRONzaQjjxTrj7kz+5npdi1FbkZhIcN2qm0B4OhSdA8ZD76LanMQhjlYw/PWUP0r/jHaQPFGeXefsPt1iQTxBnpi2ZpSknP7rt1CRpZy7NYcitTIcyXxKm+aoDWEOKowa+z4KQdLso LrdnIF4B BAL92CcDvnIINKeSWux7ZZiYkcAkw8lGrUN7CY7KL3+gp5ChMpgsuiiNB/lstlIlFVtqNed9Ew+bn8jLkdOK6dWNwD6uNTVWAIz15GJbm1QbNRd3ctXpXXPIr5XPHOp3Embuxln3ALkKI0UxpPfQ6n0mahUeDqlaJlbHLUpbtwpD1321U18ep8W0S0ARhPsGmEqI23HJ4uHEShu2O4XfDnlPTaQtfFZaA6Eff3G+nLktUlba+nrAKM3vQySpet2ssA5WW5foh9jQRFp118CDsnqwws8UdcrfL4UETYKDFTbIOKSpJ/0RqkuJbG633XTo4H03CBwDCmgxudBPRhEUrgRJtt/e4azJZvefm60XHUru8FRBEk7Uu8JuiUPpR6QhPql4R8kogFTxb5kZJh+1Txz191HaceWVIas4b5b2lUmRwI+0Ku2X2/8zrYcZjOgnNa9tqUwHsd5DD4kUZ9+AhJIfSZQ== 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: Hi Carlos, On Mon, 15 May 2023, Carlos Maiolino wrote: > On Wed, Apr 26, 2023 at 12:20:02PM +0200, cem@kernel.org wrote: > > From: Carlos Maiolino > > > > Hello folks. > > > > This is the final version of the quota support from tmpfs, with all the issues > > addressed, and now including RwB tags on all patches, and should be ready for > > merge. Details are within each patch, and the original cover-letter below. > > > > Ping? Can somebody manage to pickup these patches? Sorry, but it won't be me picking them up. Let's Cc Andrew Morton, through whose mm tree mm/shmem.c patches usually go. fs-wide updates often go through the fs tree, but this is not really in that category: it's a specific addition of a feature new to tmpfs; plus I see that Andrew did have plenty of quota involvement back in the day. And let's Cc Christian Brauner, who was raising namespace questions in November. tmpfs quotas: not a feature that I was ever hoping for, though I might have joked about it twenty years ago. Already we had the nr_blocks= or size= restriction; and the vm_enough_memory strict-non-overcommit restriction; and later the memcg charging restriction. Nowadays, with namespaces (and tmpfs FS_USERNS_MOUNT), I'd have imagined that the natural way to proceed would be to mount a size-limited tmpfs into the namespace of the user to be limited - but I'm no system designer, and likely just boasting my ignorance of namespaces again. It does look as if Lukas and you have done a good job here: it's a much lighter "invasion" than I was expecting (and the de-indentation changes looked reasonable to me too, though I didn't check through them). I was puzzled where the i_blocks accounting had vanished, but found it eventually in the dquot stubs. So, I don't have an actual objection, and it counts for a lot that you have Jan Kara on board; but this is not work that I shall be able to support myself (I'll rarely even turn the CONFIG on). If Andrew thinks it should go in, then you will be needed to maintain it. IIRC there's an outstanding issue, that namespaces are not properly supported here. Given Christian's work on idmapping, that will be unfortunate; but if it's just that you were waiting for the base series to go in, before correcting the namespace situation, that's understandable and should not delay further - but I hope that you know what more is needed, and that it won't add much more code. Hugh > > Thanks! > > > Hi folks. this work has been done originally by Lukas, but he left the company, > > so I'm taking over his work from where he left it of. This series is virtually > > done, and he had updated it with comments from the last version, but, I'm > > initially posting it as a RFC because it's been a while since he posted the > > last version. > > Most of what I did here was rebase his last work on top of current Linus's tree. > > > > Honza, there is one patch from you in this series, which I believe you had it > > suggested to Lukas on a previous version. > > > > The original cover-letter follows... > > > > 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]. > > > > [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 > > > > > > Jan Kara (1): > > quota: Check presence of quota operation structures instead of > > ->quota_read and ->quota_write callbacks > > > > Lukas Czerner (5): > > shmem: make shmem_inode_acct_block() return error > > shmem: make shmem_get_inode() return ERR_PTR instead of NULL > > shmem: prepare shmem quota infrastructure > > shmem: quota support > > Add default quota limit mount options > > > > Documentation/filesystems/tmpfs.rst | 31 ++ > > fs/Kconfig | 12 + > > fs/quota/dquot.c | 2 +- > > include/linux/shmem_fs.h | 28 ++ > > include/uapi/linux/quota.h | 1 + > > mm/Makefile | 2 +- > > mm/shmem.c | 465 +++++++++++++++++++++------- > > mm/shmem_quota.c | 350 +++++++++++++++++++++ > > 8 files changed, 783 insertions(+), 108 deletions(-) > > create mode 100644 mm/shmem_quota.c > > > > Signed-off-by: Carlos Maiolino > > -- > > 2.30.2 > > > > -- > Carlos Maiolino