From: Mateusz Guzik <[email protected]>
To: Al Viro <[email protected]>
Cc: [email protected], [email protected], [email protected],
[email protected], [email protected],
[email protected], [email protected]
Subject: Re: [PATCH] fs: support filename refcount without atomics
Date: Fri, 7 Mar 2025 17:44:57 +0100 [thread overview]
Message-ID: <CAGudoHGwaoCMnpFyF3Zxm4BxLqyYD8TiRtpdTyfjJspVa=Re9A@mail.gmail.com> (raw)
In-Reply-To: <20250307164216.GI2023217@ZenIV>
On Fri, Mar 7, 2025 at 5:42 PM Al Viro <[email protected]> wrote:
>
> On Fri, Mar 07, 2025 at 05:11:55PM +0100, Mateusz Guzik wrote:
> > Atomics are only needed for a combination of io_uring and audit.
> >
> > Regular file access (even with audit) gets around fine without them.
> >
> > With this patch 'struct filename' starts with being refcounted using
> > regular ops.
> >
> > In order to avoid API explosion in the getname*() family, a dedicated
> > routine is added to switch the obj to use atomics.
> >
> > This leaves the room for merely issuing getname(), not issuing the
> > switch and still trying to manipulate the refcount from another thread.
> >
> > Catching such cases is facilitated by CONFIG_DEBUG_VFS-dependent
> > tracking of who created the given filename object and having refname()
> > and putname() detect if another thread is trying to modify them.
>
> Not a good way to handle that, IMO.
>
> Atomics do hurt there, but they are only plastering over the real
> problem - names formed in one thread, inserted into audit context
> there and operation involving them happening in a different thread.
>
> Refcounting avoids an instant memory corruption, but the real PITA
> is in audit users of that stuff.
>
> IMO we should *NOT* grab an audit names slot at getname() time -
> that ought to be done explicitly at later points.
>
> The obstacle is that currently there still are several retry loop
> with getname() done in it; I've most of that dealt with, need to
> finish that series.
>
> And yes, refcount becomes non-atomic as the result.
Well yes, it was audit which caused the appearance of atomics in the
first place. I was looking for an easy way out.
If you have something which gets rid of the underlying problem and it
is going to land in the foreseeable future, I wont be defending this
approach.
--
Mateusz Guzik <mjguzik gmail.com>
next prev parent reply other threads:[~2025-03-07 16:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 16:11 [PATCH] fs: support filename refcount without atomics Mateusz Guzik
2025-03-07 16:18 ` Jens Axboe
2025-03-07 16:25 ` Mateusz Guzik
2025-03-07 16:32 ` Jens Axboe
2025-03-07 16:35 ` Mateusz Guzik
2025-03-07 16:38 ` Jens Axboe
2025-03-07 16:39 ` Mateusz Guzik
2025-03-07 16:26 ` Matthew Wilcox
2025-03-07 16:32 ` Mateusz Guzik
2025-03-07 16:42 ` Al Viro
2025-03-07 16:44 ` Mateusz Guzik [this message]
2025-03-07 22:58 ` Mateusz Guzik
2025-03-08 13:35 ` kernel test robot
2025-03-08 13:46 ` 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='CAGudoHGwaoCMnpFyF3Zxm4BxLqyYD8TiRtpdTyfjJspVa=Re9A@mail.gmail.com' \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox