From: Al Viro <viro@zeniv.linux.org.uk>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Jann Horn <jannh@google.com>
Subject: Re: [PATCH][RFC] make take_dentry_name_snapshot() lockless
Date: Mon, 23 Dec 2024 04:25:40 +0000 [thread overview]
Message-ID: <20241223042540.GG1977892@ZenIV> (raw)
In-Reply-To: <20241210024523.GD3387508@ZenIV>
On Tue, Dec 10, 2024 at 02:45:23AM +0000, Al Viro wrote:
> On Mon, Dec 09, 2024 at 11:12:37PM +0000, Al Viro wrote:
> >
> > Actually, grepping for DNAME_INLINE_LEN brings some interesting hits:
> > drivers/net/ieee802154/adf7242.c:1165: char debugfs_dir_name[DNAME_INLINE_LEN + 1];
> > cargo-culted, AFAICS; would be better off with a constant of their own.
> >
> > fs/ext4/fast_commit.c:326: fc_dentry->fcd_name.len > DNAME_INLINE_LEN)
> > fs/ext4/fast_commit.c:452: if (dentry->d_name.len > DNAME_INLINE_LEN) {
> > fs/ext4/fast_commit.c:1332: fc_dentry->fcd_name.len > DNAME_INLINE_LEN)
> > fs/ext4/fast_commit.h:113: unsigned char fcd_iname[DNAME_INLINE_LEN]; /* Dirent name string */
> > Looks like that might want struct name_snapshot, along with
> > {take,release}_dentry_name_snapshot().
>
> See viro/vfs.git#work.dcache. I've thrown ext4/fast_commit conversion
> into the end of that pile. NOTE: that stuff obviously needs profiling.
> It does survive light testing (boot/ltp/xfstests), but review and more
> testing (including serious profiling) is obviously needed.
>
> Patches in followups...
More fun with ->d_name, ->d_iname and friends:
87ce955b24c9 "io_uring: add ->show_fdinfo() for the io_uring file descriptor"
is playing silly buggers with ->d_iname for some reason. This
seq_printf(m, "UserFiles:\t%u\n", ctx->file_table.data.nr);
for (i = 0; has_lock && i < ctx->file_table.data.nr; i++) {
struct file *f = NULL;
if (ctx->file_table.data.nodes[i])
f = io_slot_file(ctx->file_table.data.nodes[i]);
if (f)
seq_printf(m, "%5u: %s\n", i, file_dentry(f)->d_iname);
else
seq_printf(m, "%5u: <none>\n", i);
}
produces user-visible data. For each slot in io_uring file table you
show either that it's empty (fine) or, for files with short names, the
last component of the name (no quoting, etc. - just a string as-is) or
the last short name that dentry used to have.
And that's a user-visible ABI. What the hell?
NOTE: file here is may be anything whatsoever. It may be a pipe,
an arbitrary file in tmpfs, a socket, etc.
How hard an ABI it is? If it's really used by random userland code
(admin tools, etc.), we have a problem. If that thing is cast in
stone, we'll have to emulate the current behaviour of that code,
no matter what. I really hope it can be replaced with something
saner, though.
Incidentally, call your file "<none>"; is the current behaviour
the right thing to do?
What behaviour _is_ actually wanted? Jens, Jann?
next prev parent reply other threads:[~2024-12-23 4:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-09 3:52 [PATCH][RFC] make take_dentry_name_snapshot() lockless Al Viro
2024-12-09 6:33 ` Mateusz Guzik
2024-12-09 6:58 ` Al Viro
2024-12-09 7:18 ` Mateusz Guzik
2024-12-09 7:41 ` Al Viro
2024-12-09 18:27 ` Linus Torvalds
2024-12-09 21:17 ` Al Viro
2024-12-09 22:28 ` Al Viro
2024-12-09 22:49 ` Linus Torvalds
2024-12-09 22:55 ` Linus Torvalds
2024-12-09 23:12 ` Al Viro
2024-12-10 2:45 ` Al Viro
2024-12-10 2:48 ` [PATCH 1/5] make sure that DCACHE_INLINE_LEN is a multiple of word size Al Viro
2024-12-10 2:48 ` [PATCH 2/5] dcache: back inline names with a struct-wrapped array of unsigned long Al Viro
2024-12-10 2:48 ` [PATCH 3/5] make take_dentry_name_snapshot() lockless Al Viro
2024-12-10 2:48 ` [PATCH 4/5] dissolve external_name.u into separate members Al Viro
2024-12-10 2:48 ` [PATCH 5/5] ext4 fast_commit: make use of name_snapshot primitives Al Viro
2024-12-23 4:25 ` Al Viro [this message]
2024-12-23 4:37 ` [PATCH][RFC] make take_dentry_name_snapshot() lockless Al Viro
2024-12-23 21:31 ` Jens Axboe
2024-12-24 19:18 ` Al Viro
2024-12-24 19:44 ` Linus Torvalds
2024-12-24 20:24 ` Al Viro
2024-12-09 19:06 ` Linus Torvalds
2024-12-09 20:27 ` Al Viro
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=20241223042540.GG1977892@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=axboe@kernel.dk \
--cc=jannh@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.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.