Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp210366ybh; Fri, 6 Mar 2020 19:49:23 -0800 (PST) X-Google-Smtp-Source: ADFU+vs5V+21iPwMfqSEwJqBCprKTCjBvPD6AUmpjMg3sa2beJ+kyKPzoPzzUWXc9UkJJ8Shuf+7 X-Received: by 2002:a9d:178:: with SMTP id 111mr5354838otu.238.1583552963528; Fri, 06 Mar 2020 19:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583552963; cv=none; d=google.com; s=arc-20160816; b=F77xEu3KInRWFSkNmT65hULHtFcywQLT7eJutrFpb8fp3OV7tAOYf3L27bC2V/meLa 6ogtLJTMdUBGjYq6TRZnbrgHDjnSgIhqef3goMvAAQrYRUcM8y9QlbdRHxWQh0Vn92/8 YqCRisy6eDnYzrkxLp2BHjUHIuBEIcXvbgdcZe/6fagXNldfJOHB/i30pu6bAMBMh29+ brb2DIgZ+reQc7DdmMlemw1W42BJF8FUFsxrW/oYp8OOQH4clBjeq18EXbGX0S9i7Z4Z qria8ABUOnZhXxbJXERxCmBh4ywO/x+8T2myEiE9WgANJ9xOMxT0QiRm2EJ2x+HBMCXZ hm5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=PavVmBy5q1Ud2VcUriOj6uqcJWuap1YNtqtI2Ea6UYk=; b=MsKQ3OuU4k9caQqFgyBSglKE6uMPUz5kTck+LBaeZzixcveqPxlGps2GbN4BSmEooi P96nM8cr7l7Y1bwAllWnRP2ybod+77FXkERDzG0bfIdthqOznzDUmJ+rcHeQ66Qc2On4 R7wSwoM8FfstAdypb2jiedd3zTm1u+TVXPw5y4g8wrYnwQpaNxpTnqurl4c8s2IWM0J0 gEc9rsLPGkGT4JhhnKeTOOdKVPHxBiCk8OLPd4IY6QHzEDhI190UKZ2fvar918guoMzk 3mZ/lmOSAE0bMt3lZVzno/mSYWaiF4HqgCOzRkS9fMGY7QmGKSEYir9Z+4zSxvOkks3F 2WpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w10si2351137otp.171.2020.03.06.19.49.01; Fri, 06 Mar 2020 19:49:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726259AbgCGDs5 (ORCPT + 99 others); Fri, 6 Mar 2020 22:48:57 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:43782 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726769AbgCGDs5 (ORCPT ); Fri, 6 Mar 2020 22:48:57 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jAQSI-006ea4-7q; Sat, 07 Mar 2020 03:48:50 +0000 Date: Sat, 7 Mar 2020 03:48:50 +0000 From: Al Viro To: Daniel Rosenberg Cc: Theodore Ts'o , linux-ext4@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, Eric Biggers , linux-fscrypt@vger.kernel.org, Richard Weinberger , linux-mtd@lists.infradead.org, Andreas Dilger , Jonathan Corbet , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gabriel Krisman Bertazi , kernel-team@android.com Subject: Re: [PATCH v8 2/8] fs: Add standard casefolding support Message-ID: <20200307034850.GH23230@ZenIV.linux.org.uk> References: <20200307023611.204708-1-drosen@google.com> <20200307023611.204708-3-drosen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200307023611.204708-3-drosen@google.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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?