[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200307034850.GH23230@ZenIV.linux.org.uk>
Date: Sat, 7 Mar 2020 03:48:50 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Daniel Rosenberg <drosen@...gle.com>
Cc: Theodore Ts'o <tytso@....edu>, linux-ext4@...r.kernel.org,
Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>,
linux-f2fs-devel@...ts.sourceforge.net,
Eric Biggers <ebiggers@...nel.org>,
linux-fscrypt@...r.kernel.org, Richard Weinberger <richard@....at>,
linux-mtd@...ts.infradead.org,
Andreas Dilger <adilger.kernel@...ger.ca>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Gabriel Krisman Bertazi <krisman@...labora.com>,
kernel-team@...roid.com
Subject: Re: [PATCH v8 2/8] fs: Add standard casefolding support
On Fri, Mar 06, 2020 at 06:36:05PM -0800, Daniel Rosenberg wrote:
> +/**
> + * generic_ci_d_hash - generic implementation of d_hash for casefolding
> + * @dentry: Entry whose name we are hashing
> + * @len: length of str
> + * @qstr: name of the dentry, safely paired with len
> + * @str: qstr to set hash of
> + *
> + * This performs a case insensitive hash of the given str.
> + * If casefolding is not required, it leaves the hash unchanged.
> + */
> +int generic_ci_d_hash(const struct dentry *dentry, struct qstr *str)
> +{
> + const struct inode *inode = READ_ONCE(dentry->d_inode);
> + struct super_block *sb = dentry->d_sb;
> + const struct unicode_map *um = sb->s_encoding;
> + char small_name[DNAME_INLINE_LEN];
> + struct qstr entry = QSTR_INIT(str->name, str->len);
> + int ret = 0;
> +
> + if (!inode || !needs_casefold(inode))
> + return 0;
> +
> + if (make_name_stable(um, dentry, &entry, small_name))
> + goto err;
> + ret = utf8_casefold_hash(um, dentry, &entry);
> + if (ret < 0)
> + goto err;
> +
> + return 0;
> +err:
> + if (sb_has_enc_strict_mode(sb))
> + ret = -EINVAL;
> + else
> + ret = 0;
> + return ret;
> +}
Have you even tested that? Could you tell me where does the calculated
hash go? And just what is it doing trying to check if the name we are about to
look up in directory specified by 'dentry' might be pointing to dentry->d_iname?
Powered by blists - more mailing lists