From: Dave Chinner <david@fromorbit.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: cem@kernel.org, linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Hugh Dickins <hughd@google.com>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH 3/3] tmpfs: Add project quota interface support for get/set attr
Date: Wed, 27 Sep 2023 11:09:19 +1000 [thread overview]
Message-ID: <ZROAvzJ/XahcQE14@dread.disaster.area> (raw)
In-Reply-To: <E5CA9BA7-513A-4D63-B183-B137B727D026@dilger.ca>
On Tue, Sep 26, 2023 at 02:28:06PM -0600, Andreas Dilger wrote:
> I've added Dave to the CC list, since he has a deep understanding
> of the projid code since it originated from XFS.
>
> On Sep 25, 2023, at 7:00 AM, cem@kernel.org wrote:
> >
> > From: Carlos Maiolino <cem@kernel.org>
> >
> > Not project quota support is in place, enable users to use it.
>
> There is a peculiar behavior of project quotas, that rename across
> directories with different project IDs and PROJINHERIT set should
> cause the project ID to be updated (similar to BSD setgid).
>
> For renaming regular files and other non-directories, it is OK to
> change the projid and update the quota for the old and new IDs
> to avoid copying all of the data needlessly. For directories this
> (unfortunately) means that the kernel should return -EXDEV if the
> project IDs don't match, and then "mv" will create a new target
> directory and resume moving the files (which are thankfully still
> done with a rename() call if possible).
>
> The reason for this is that just renaming the directory does not
> atomically update the projid on all of the (possibly millions of)
> sub-files/sub-dirs, which is required for PROJINHERIT directories.
Yup, PROJINHERIT implies that project quotas are being used to
implement directory tree quotas, hence everything in the destination
directory should have the same projid as the parent. This code in
xfs_rename() implements that restriction:
/*
* If we are using project inheritance, we only allow renames
* into our tree when the project IDs are the same; else the
* tree quota mechanism would be circumvented.
*/
if (unlikely((target_dp->i_diflags & XFS_DIFLAG_PROJINHERIT) &&
target_dp->i_projid != src_ip->i_projid)) {
error = -EXDEV;
goto out_trans_cancel;
}
> Another option for tmpfs to maintain this PROJINHERIT behavior would
> be to rename the directory and then spawn a background kernel thread
> to change the projids on the whole tree. Since tmpfs is an in-memory
> filesystem there will be a "limited" number of files and subdirs
> to update, and you don't need to worry about error handling if the
> system crashes before the projid updates are done.
Except that can get EDQUOT half way through and now there's nothing
to report the ENOSPC error to, nor any way that the application can
interrupt and/or recover the situation. I think that's a
non-starter.
And, quite frankly, it's also massive feature creep as well as
premature optimisation. We don't need tmpfs project quotas to be
"smart" like this; we just need the initial support patch set to -do
the right thing-.
-Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2023-09-27 3:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-25 13:00 [RFC PATCH 0/3] tmpfs: Add tmpfs project quota support cem
2023-09-25 13:00 ` [PATCH 1/3] tmpfs: add project ID support cem
2023-10-03 11:23 ` Jan Kara
2023-09-25 13:00 ` [PATCH 2/3] tmpfs: Add project quota mount option cem
2023-09-25 13:00 ` [PATCH 3/3] tmpfs: Add project quota interface support for get/set attr cem
2023-09-26 20:28 ` Andreas Dilger
2023-09-27 1:09 ` Dave Chinner [this message]
2023-09-27 12:48 ` Carlos Maiolino
2023-09-26 21:35 ` kernel test robot
2023-10-02 8:41 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZROAvzJ/XahcQE14@dread.disaster.area \
--to=david@fromorbit.com \
--cc=adilger@dilger.ca \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.