On Fri, Nov 25, 2022 at 10:14:53AM +0100, Jan Kara wrote: > On Fri 25-11-22 09:59:48, Lukas Czerner wrote: > > On Wed, Nov 23, 2022 at 05:37:45PM +0100, Jan Kara wrote: > > > On Mon 21-11-22 15:28:53, Lukas Czerner wrote: > > > > Implement user and group quota support for tmpfs using system quota file > > > > in vfsv0 quota format. Because everything in tmpfs is temporary and as a > > > > result is lost on umount, the quota files are initialized on every > > > > mount. This also goes for quota limits, that needs to be set up after > > > > every mount. > > > > > > > > The quota support in tmpfs is well separated from the rest of the > > > > filesystem and is only enabled using mount option -o quota (and > > > > usrquota and grpquota for compatibility reasons). Only quota accounting > > > > is enabled this way, enforcement needs to be enable by regular quota > > > > tools (using Q_QUOTAON ioctl). > > > > > > > > Signed-off-by: Lukas Czerner <lczerner@xxxxxxxxxx> > > > > > > ... > > > > > > > diff --git a/Documentation/filesystems/tmpfs.rst b/Documentation/filesystems/tmpfs.rst > > > > index 0408c245785e..9c4f228ef4f3 100644 > > > > --- a/Documentation/filesystems/tmpfs.rst > > > > +++ b/Documentation/filesystems/tmpfs.rst > > > > @@ -86,6 +86,18 @@ use up all the memory on the machine; but enhances the scalability of > > > > that instance in a system with many CPUs making intensive use of it. > > > > > > > > > > > > +tmpfs also supports quota with the following mount options > > > > + > > > > +======== ============================================================= > > > > +quota Quota accounting is enabled on the mount. Tmpfs is using > > > > + hidden system quota files that are initialized on mount. > > > > + Quota limits can quota enforcement can be enabled using > > > ^^^ and? > > > > > > > + standard quota tools. > > > > +usrquota Same as quota option. Exists for compatibility reasons. > > > > +grpquota Same as quota option. Exists for compatibility reasons. > > > > > > As we discussed with V1, I'd prefer if user & group quotas could be enabled > > > / disabled independently. Mostly to not differ from other filesystems > > > unnecessarily. > > > > Ok, but other file systems (at least xfs and ext) differs. Mounting ext4 > > file system with quota feature with default quota option settings will > > always enable accounting for both user and group. Mount options quota, > > usrquota and grpquota enables enforcement; selectively with the last > > two. > > > > On xfs with no mount options quota is disabled. With quota, usrquota and > > grpquota enforcement is enabled, again selectively with the last two. > > > > And yes, with this implementation tmpfs is again different. The idea was > > to allow enabling accounting and enforcement (with default limits) > > selectively. > > > > So how would you like the tmpfs to do it? I think having accounting only > > can be useful and I'd like to keep it. Maybe adding qnoenforce, > > uqnoenforce and qgnoenforce mount options, but that seems cumbersome to > > me and enabling accounting by default seems a bit much. What do you think? > > So I wanted things to be as similar to other filesystems as possible. So > quota, usrquota, grpquota would enable quota accounting & enforcement (the > last two selectively). If we want the possibility to enable accounting > without enforcement that can be done by some special mount options (and > possibly we can add them when there's user demand). Also note that there's > always the possibility to disable quota enforcement using quota tools when > needed. But IMHO 99% of users will want accounting & enforcement and thus > that should be the default like with other filesystems. > > Honza Alright I'll do that. Thanks! -Lukas > -- > Jan Kara <jack@xxxxxxxx> > SUSE Labs, CR >