Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5706138ybv; Tue, 11 Feb 2020 22:07:06 -0800 (PST) X-Google-Smtp-Source: APXvYqyERa/ihtmMdGK1PygL4waHGyfgvqzPu7IDm/awHswMkjExTlzDPrHlT4Gsy38xz9P/1OEY X-Received: by 2002:a05:6808:319:: with SMTP id i25mr5287198oie.128.1581487626761; Tue, 11 Feb 2020 22:07:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581487626; cv=none; d=google.com; s=arc-20160816; b=xAa4dHS6sDUEs0Hom5uurkoO/d61sNB1IQYTTVPAcBSRGgHS8NPzwvMcsH5q1Pkcce DzY8kNeIHuW7/QPnPhulH6oOXIpyvALW6UMfx+nvTkDJZJ1AC5Nyc1xyW7Gjn8ZUwcDZ R8ql5rL3b+CWP/1G5L7ha+6rdWQ6HvtfYSs9CxrySLlXNJXO2vp1XiHpvIYFPK33iN+B GFDZOm38MtHdj7rrV6frH32voyXQxXtEIljYBBIoBOH/cofHer3RwBMluskZ05WPWz7s NBYQLoK5VdyuuXOAokpDFXwn9FcZkUO1dI2yP30PK/F1J/9JF6hk+ZD6d0lwwqHpcy88 NrfA== 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 :dkim-signature; bh=FLgjWoiEq5bxpO7wNKbOzIxQUXy6M9oFvCeb+6gznng=; b=zS/cQFI+8jcl7AxaKISmzUbK5kkQYtSycMCRMXK1tuIOJNKVS786xmHs5XTvJguIfO QdPOVQtgbBaiMOlPnkKpLhEhEbFWOD2cM6pWIDapQYxPFHqKWLQyE327PJVBeefGOnMO ZXgLGSHpAnOs15GRtx+/M3lJzfveOXcjSXlCivtXpVE9r9CrYdmTXp8bKBOC7uAHgFA0 dVuITU6G5JPsZGdxRg572YkqomdDzO1NfTqjIzVIZxgVORtG25x9PPNit7lqU9Q7B4jf cl//kuGje5Jhp/rL9X6T9ECgKX7BvY1Vh9jCg3WOhD5bR9AYZNc2gMxarRGRCoBlv26r U6ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=j5hgBd1b; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si3082884otr.18.2020.02.11.22.06.54; Tue, 11 Feb 2020 22:07:06 -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; dkim=pass header.i=@kernel.org header.s=default header.b=j5hgBd1b; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728212AbgBLGGp (ORCPT + 99 others); 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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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