linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix dcache lookup of !casefolded directories
@ 2019-05-24 22:41 Gabriel Krisman Bertazi
  2019-05-25  3:58 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel Krisman Bertazi @ 2019-05-24 22:41 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4, Gabriel Krisman Bertazi

Found by visual inspection, this wasn't caught by my xfstest, since it's
effect is ignoring positive dentries in the cache the fallback just goes
to the disk.  it was introduced in the last iteration of the
case-insensitive patch.

d_compare should return 0 when the entries match, so make sure we are
correctly comparing the entire string if the encoding feature is set and
we are on a case-INsensitive directory.

Fixes: b886ee3e778e ("ext4: Support case-insensitive file name lookups")
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
---
 fs/ext4/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index 884a6e776809..c7843b149a1e 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -671,7 +671,7 @@ static int ext4_d_compare(const struct dentry *dentry, unsigned int len,
 	if (!IS_CASEFOLDED(dentry->d_parent->d_inode)) {
 		if (len != name->len)
 			return -1;
-		return !memcmp(str, name, len);
+		return memcmp(str, name->name, len);
 	}
 
 	return ext4_ci_compare(dentry->d_parent->d_inode, name, &qstr);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: Fix dcache lookup of !casefolded directories
  2019-05-24 22:41 [PATCH] ext4: Fix dcache lookup of !casefolded directories Gabriel Krisman Bertazi
@ 2019-05-25  3:58 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-05-25  3:58 UTC (permalink / raw)
  To: Gabriel Krisman Bertazi; +Cc: linux-ext4

On Fri, May 24, 2019 at 06:41:29PM -0400, Gabriel Krisman Bertazi wrote:
> Found by visual inspection, this wasn't caught by my xfstest, since it's
> effect is ignoring positive dentries in the cache the fallback just goes
> to the disk.  it was introduced in the last iteration of the
> case-insensitive patch.
> 
> d_compare should return 0 when the entries match, so make sure we are
> correctly comparing the entire string if the encoding feature is set and
> we are on a case-INsensitive directory.
> 
> Fixes: b886ee3e778e ("ext4: Support case-insensitive file name lookups")
> Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>

Applied, thanks.

I'll note that half the implementations of *_d_compare seem to use
!!memcmp(), and half use memcmp().

The callers of d_compare only seems to care if it's 0 or != 0, so I
guess it doesn't matter...

				- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-25  3:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-24 22:41 [PATCH] ext4: Fix dcache lookup of !casefolded directories Gabriel Krisman Bertazi
2019-05-25  3:58 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).