From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Cc: "Christian Brauner \(Amutable\)" <brauner@kernel.org>,
Jan Kara <jack@suse.cz>,
linux-f2fs-devel@lists.sourceforge.net,
linux-xfs@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
linux-ext4@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH 0/2] dcache: don't leave negative dentries in casefolded directories
Date: Mon, 26 Oct 2026 11:36:53 -0400 [thread overview]
Message-ID: <87y0bkqxre.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <20261023-work-dcache-casefold-v1-0-1b0bd5c73a69@kernel.org>
Christian Brauner <brauner@kernel.org> writes:
> ext4, f2fs and tmpfs keep negative dentries out of casefolded
> directories. A negative dentry remembers one spelling of the name and
> the next create() through it would write that spelling to disk.
>
> So their ->lookup() doesn't cache a miss and their ->unlink() and
> ->rmdir() call d_invalidate() on the dentry so that d_delete() doesn't
> turn it into a negative dentry.
>
> But d_invalidate() is the wrong primitive for that. It's for a name that
> went stale. It walks the subtree, prunes it and detaches every mount it
> finds, under namespace_sem, and here that runs from inside the
> filesystem's own directory operation. ext4_rmdir() does it with the
> journal handle still open and ext4_unlink() does it even when the
> unlink failed. All anyone wanted is the unhash.
>
> So d_delete() now unhashes the dentry when the parent is casefolded,
> next to the dentry-negative sysctl that does the same for every
> directory. ext4, f2fs and tmpfs drop their d_invalidate() calls.
>
> xfs's ascii-ci doesn't set S_CASEFOLD and can't so it d_drop()s instead.
> I did consider setting S_CASEFOLD on ascii-ci directories and didn't.
> overlayfs warns when a layer's casefold flag disagrees with the
> superblock having an encoding, and xfs has none.
>
> Nothing changes for userspace. A miss still isn't cached and a removed
> name still leaves no negative dentry behind. Verified with the same
> create, unlink, create, readdir and stat sequence in a plain and in a
> casefolded directory on tmpfs and on ext4, before and after.
I think the change looks fine and it passed fstests.
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Of course, the better approach would be to enable negative dentries
but the last attempt went sideways, though not for any good reason.
thanks!
--
Gabriel Krisman Bertazi
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Christian Brauner <brauner@kernel.org>, linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-xfs@vger.kernel.org,
"Christian Brauner (Amutable)" <brauner@kernel.org>
Subject: Re: [PATCH 0/2] dcache: don't leave negative dentries in casefolded directories
Date: Mon, 26 Oct 2026 11:36:53 -0400 [thread overview]
Message-ID: <87y0bkqxre.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <20261023-work-dcache-casefold-v1-0-1b0bd5c73a69@kernel.org>
Christian Brauner <brauner@kernel.org> writes:
> ext4, f2fs and tmpfs keep negative dentries out of casefolded
> directories. A negative dentry remembers one spelling of the name and
> the next create() through it would write that spelling to disk.
>
> So their ->lookup() doesn't cache a miss and their ->unlink() and
> ->rmdir() call d_invalidate() on the dentry so that d_delete() doesn't
> turn it into a negative dentry.
>
> But d_invalidate() is the wrong primitive for that. It's for a name that
> went stale. It walks the subtree, prunes it and detaches every mount it
> finds, under namespace_sem, and here that runs from inside the
> filesystem's own directory operation. ext4_rmdir() does it with the
> journal handle still open and ext4_unlink() does it even when the
> unlink failed. All anyone wanted is the unhash.
>
> So d_delete() now unhashes the dentry when the parent is casefolded,
> next to the dentry-negative sysctl that does the same for every
> directory. ext4, f2fs and tmpfs drop their d_invalidate() calls.
>
> xfs's ascii-ci doesn't set S_CASEFOLD and can't so it d_drop()s instead.
> I did consider setting S_CASEFOLD on ascii-ci directories and didn't.
> overlayfs warns when a layer's casefold flag disagrees with the
> superblock having an encoding, and xfs has none.
>
> Nothing changes for userspace. A miss still isn't cached and a removed
> name still leaves no negative dentry behind. Verified with the same
> create, unlink, create, readdir and stat sequence in a plain and in a
> casefolded directory on tmpfs and on ext4, before and after.
I think the change looks fine and it passed fstests.
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Of course, the better approach would be to enable negative dentries
but the last attempt went sideways, though not for any good reason.
thanks!
--
Gabriel Krisman Bertazi
next prev parent reply other threads:[~2026-10-26 15:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 12:44 [PATCH 0/2] dcache: don't leave negative dentries in casefolded directories Christian Brauner
2026-10-23 12:44 ` [f2fs-dev] " Christian Brauner via Linux-f2fs-devel
2026-10-23 12:44 ` [PATCH 1/2] " Christian Brauner
2026-10-23 12:44 ` [f2fs-dev] " Christian Brauner via Linux-f2fs-devel
2026-10-23 13:00 ` sashiko-bot
2026-10-24 19:20 ` [f2fs-dev] " Eric Biggers via Linux-f2fs-devel
2026-10-24 19:20 ` Eric Biggers
2026-10-26 8:12 ` Christian Brauner
2026-10-26 8:12 ` [f2fs-dev] " Christian Brauner via Linux-f2fs-devel
2026-10-26 12:19 ` Jan Kara
2026-10-26 12:19 ` Jan Kara
2026-10-23 12:44 ` [PATCH 2/2] xfs: unhash a removed name in ascii-ci mode instead of invalidating it Christian Brauner
2026-10-23 12:44 ` [f2fs-dev] " Christian Brauner via Linux-f2fs-devel
2026-10-23 12:49 ` sashiko-bot
2026-10-26 15:36 ` Gabriel Krisman Bertazi [this message]
2026-10-26 15:36 ` [PATCH 0/2] dcache: don't leave negative dentries in casefolded directories Gabriel Krisman Bertazi
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=87y0bkqxre.fsf@mailhost.krisman.be \
--to=krisman@suse.de \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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.