From: Shreeya Patel <shreeya.patel@collabora.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, krisman@collabora.com,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@collabora.com
Subject: Re: [PATCH 1/2] fs: dcache: Handle case-exact lookup in d_alloc_parallel
Date: Tue, 5 Oct 2021 18:39:59 +0530 [thread overview]
Message-ID: <589db4cf-5cab-2d1f-10ce-3a5009685948@collabora.com> (raw)
In-Reply-To: <YVmyYP25kgGq9uEy@zeniv-ca.linux.org.uk>
On 03/10/21 7:08 pm, Al Viro wrote:
> On Wed, Sep 29, 2021 at 04:23:38PM +0530, Shreeya Patel wrote:
>> There is a soft hang caused by a deadlock in d_alloc_parallel which
>> waits up on lookups to finish for the dentries in the parent directory's
>> hash_table.
>> In case when d_add_ci is called from the fs layer's lookup functions,
>> the dentry being looked up is already in the hash table (created before
>> the fs lookup function gets called). We should not be processing the
>> same dentry that is being looked up, hence, in case of case-insensitive
>> filesystems we are making it a case-exact match to prevent this from
>> happening.
> NAK. What you are doing would lead to parallel calls of ->lookup() in the
> same directory for names that would compare as equal. Which violates
> all kinds of assumptions in the analysis of dentry tree locking.
>
> d_add_ci() is used to force the "exact" spelling of the name on lookup -
> that's the whole point of that thing. What are you trying to achieve,
> and what's the point of mixing that with non-trivial ->d_compare()?
>
Sending again as plain text...
Hi Al Viro,
This patch was added to resolve some of the issues faced in patch 02/02
of the series.
Originally, the 'native', per-directory case-insensitive implementation
merged in ext4/f2fs stores the case of the first lookup on the dcache,
regardless of the disk exact file name case. This gets reflected in symlink
returned by /proc/self/cwd.
To solve this we are calling d_add_ci from the fs lookup function to
store the
disk exact name in the dcache even if an inexact-match string is used on
the FIRST lookup.
But this caused a soft hang since there was a deadlock in d_wait_lookup
called from d_alloc_parallel.
The reason for the hang is that d_same_name uses d_compare which does a
case-insensitive match and is able to find the dentry name in the
secondary hash table
leading it to d_wait_lookup which would wait for the lookup to finish on
that dentry
causing a deadlock.
To avoid the hang, we are doing a case-sensitive match using dentry_cmp
here.
Thanks
> If it's "force to exact spelling on lookup, avoid calling ->lookup() on
> aliases", d_add_ci() is simply not a good match.
next prev parent reply other threads:[~2021-10-05 13:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-29 10:53 [PATCH 0/2] Handle a soft hang and the inconsistent name issue Shreeya Patel
2021-09-29 10:53 ` [PATCH 1/2] fs: dcache: Handle case-exact lookup in d_alloc_parallel Shreeya Patel
2021-10-01 18:35 ` Gabriel Krisman Bertazi
2021-10-03 13:52 ` Al Viro
2021-10-03 13:38 ` Al Viro
2021-10-05 13:09 ` Shreeya Patel [this message]
2021-09-29 10:53 ` [PATCH 2/2] fs: ext4: Fix the inconsistent name exposed by /proc/self/cwd Shreeya Patel
2021-10-01 18:41 ` Theodore Ts'o
2021-10-01 19:11 ` Gabriel Krisman Bertazi
2021-10-02 1:21 ` Theodore Ts'o
2021-10-14 21:54 ` Gabriel Krisman Bertazi
2021-10-01 18:16 ` [PATCH 0/2] Handle a soft hang and the inconsistent name issue 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=589db4cf-5cab-2d1f-10ce-3a5009685948@collabora.com \
--to=shreeya.patel@collabora.com \
--cc=adilger.kernel@dilger.ca \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®