From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBD35C2BA83 for ; Wed, 12 Feb 2020 06:06:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AC89020848 for ; Wed, 12 Feb 2020 06:06:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581487606; bh=l14Pn3KEL9YjzF1tPgOKaV7EFnEulcGerPufvbmsbT0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=VaQhOy6joIthmEsyWUzfCNt/VjLophAVlUeuAHp0LqfMTzX+Tdoagt4coHaWIr8zf gv2Y42uAGC2q/4cic/Zh/yFjCvvTJyG6a7vvMiMnadHQEesfPmebZXBj0U7IHmqBB8 ry7bNWC2q8ou/bAncK0Jis/JEA+FgmwIS9vmpxew= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728229AbgBLGGp (ORCPT ); Wed, 12 Feb 2020 01:06:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:44012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725887AbgBLGGp (ORCPT ); Wed, 12 Feb 2020 01:06:45 -0500 Received: from sol.localdomain (c-107-3-166-239.hsd1.ca.comcast.net [107.3.166.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 20AE2206ED; Wed, 12 Feb 2020 06:06:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581487604; bh=l14Pn3KEL9YjzF1tPgOKaV7EFnEulcGerPufvbmsbT0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j5hgBd1bdd/1YHYNsBxsxgHhUKtp/yLRqow31sWL4QpSNfOvdiTIIPgVDMyiAGJqg XUT1ZKQCNzV6zDB/nYfmYOsQBd6GPJPIW692CSRtURC/qPWn7rFN0+Tggepd4CFCDC toZnWhAiEsjvVOMYcB1lfDxfzgO1q24ahIVd4gpI= Date: Tue, 11 Feb 2020 22:06:42 -0800 From: Eric Biggers To: Al Viro Cc: Daniel Rosenberg , Theodore Ts'o , linux-ext4@vger.kernel.org, Jaegeuk Kim , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, 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 v7 6/8] f2fs: Handle casefolding with Encryption Message-ID: <20200212060642.GJ870@sol.localdomain> References: <20200208013552.241832-1-drosen@google.com> <20200208013552.241832-7-drosen@google.com> <20200212051013.GG870@sol.localdomain> <20200212055511.GL23230@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200212055511.GL23230@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 12, 2020 at 05:55:11AM +0000, Al Viro wrote: > On Tue, Feb 11, 2020 at 09:10:13PM -0800, Eric Biggers wrote: > > > How about: > > > > int f2fs_ci_compare(const struct inode *parent, const struct qstr *name, > > u8 *de_name, size_t de_name_len, bool quick) > > { > > const struct super_block *sb = parent->i_sb; > > const struct unicode_map *um = sb->s_encoding; > > struct fscrypt_str decrypted_name = FSTR_INIT(NULL, de_name_len); > > struct qstr entry = QSTR_INIT(de_name, de_name_len); > > int ret; > > > > if (IS_ENCRYPTED(parent)) { > > oops. parent->d_inode is unstable here; could have become NULL by that > point. > > > if (quick) > > ret = utf8_strncasecmp_folded(um, name, &entry); > > else > > ret = utf8_strncasecmp(um, name, &entry); > > if (ret < 0) { > > /* Handle invalid character sequence as either an error > > * or as an opaque byte sequence. > > */ > > Really? How would the callers possibly tell mismatch from an > error? And if they could, would would they *do* with that > error, seeing that it might be an effect of a race with > rename()? > > Again, ->d_compare() is NOT given a stable name. Or *parent. Or > (parent->d_inode). After the patch earlier in the series that created generic_ci_d_compare() and switched f2fs to use it, f2fs_ci_compare() is only called when the filesystem is actually searching a directory, not from ->d_compare(). So the names and parent->d_inode are stable in it. But, that also means the GFP_ATOMIC isn't needed, and f2fs_ci_compare() should be made 'static'. - Eric