ext4: Fix dcache lookup of !casefolded directories
PATCH 1/1 ext4: Fix dcache lookup of !casefolded directories
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.
--- fs/ext4/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/dir.c +1 -1
@@ -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);
Signature · 1 line
2.20.1
Quoted 11 lines · 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_compareshould 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 <[email protected]>
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