Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8779161rwp; Wed, 19 Jul 2023 15:29:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlERNPO9aqqfax6uIXm9MdMNwiOy14DBTG6WmCO2qS2vIDn3TZQvbtyezdkHP83VbNMamgVF X-Received: by 2002:a05:651c:120f:b0:2b7:344c:a039 with SMTP id i15-20020a05651c120f00b002b7344ca039mr446722lja.33.1689805770443; Wed, 19 Jul 2023 15:29:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689805770; cv=none; d=google.com; s=arc-20160816; b=BJy0tNWwiASQV472ZCBqIHaIC5dlKZp2RvypD5ZtorXBXhpzlH4cKISY9F3hRqZ9df L9z30HR5NYiSZ19maT21q/KMim1uVJhasQSZAQN7IVeaPeuimj20M6FgIbU1hegsdWUO edjnJm8nMI4ap7cdehMpxtV/slN6KCTa7aliZ3d4EoEUduNUQFN4ykMVlGul9/XsRlTM WT/BZJ8wxfskmkm2oH2XBv2qocno05FCMqSdJGzBTdlGIwpaGeffEW781rqES1rH+8qx IkHiB7xmqP7iR8ydXpRCWAVzarWmM293+Hwapc1SF9612HXPw2d+8V7AcfcHsqHEaAXn KVOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=6/tW1jwjtYiYuyuYvkAhhibnCktQlXT3ch84n1xLpug=; fh=HFDFbc5lRXwuu0vgGURCiLYm5ywsvQKdSNBX4pGxTs4=; b=d451J/dDWTGwRkKykMYO/fkYHE5shwVtEKgHrZDHe0S5N8KviepjgG6d75R4URY15Y HUq4EY3f67xBG713DZEVxc3nTnSaGAdH4oh9OHdlwV76Wq981pmNuWwoSyejG4Hsod60 cBqWf9BJr+JVH7xIX8XVinNpQ233VzpBaGlUmSlDdFXUkwVA5B0D5m0vGoDkTMSaWDnn FP/vD20BAmMY5YzNBvQxgyQ7Ov2ERnvrI0IF2Azo2sP1W0QMrl2rHlmH0NfLHnL1TM27 Pyg1A0kFn7ClsBleaWrvDwiVE/Cu83rJLypZwtHR2alFXl3ROJ04Sh1LS1vSKVh4t6rZ nhNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cEnkxHe+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lw6-20020a170906bcc600b0098be1e9150fsi3545568ejb.298.2023.07.19.15.29.06; Wed, 19 Jul 2023 15:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=cEnkxHe+; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230150AbjGSWTp (ORCPT + 99 others); Wed, 19 Jul 2023 18:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230041AbjGSWTo (ORCPT ); Wed, 19 Jul 2023 18:19:44 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C5351FE2; Wed, 19 Jul 2023 15:19:43 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E143C201F4; Wed, 19 Jul 2023 22:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1689805181; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6/tW1jwjtYiYuyuYvkAhhibnCktQlXT3ch84n1xLpug=; b=cEnkxHe+UsuyjDVj6XL5wA6Z+bkAQihPivpsmBcqpWrLtLB9l19KFwPYhFQncP0bcmLDEV Ev92yZwoOcQMc3r8FDuZku4ylbc18jj1qEuRHFmfTOk4PCToTb8XYblgNuFgRFxDIv/ozU QF2uNP3Rasvt9E5zX5HSx27GEF0Eqzw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1689805181; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6/tW1jwjtYiYuyuYvkAhhibnCktQlXT3ch84n1xLpug=; b=b8Bv98GohOXdHX3r1XFWI6y9b+HDUH7BvRGIw8kIvwIcdV7glP1Vkrh36PjIR0v2y53ZVQ njf7ikKKpaoUC1Cg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A8F181361C; Wed, 19 Jul 2023 22:19:41 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id nCZ8I31huGQuJgAAMHmgww (envelope-from ); Wed, 19 Jul 2023 22:19:41 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org, tytso@mit.edu, ebiggers@kernel.org, jaegeuk@kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi , Gabriel Krisman Bertazi Subject: [PATCH v3 7/7] f2fs: Enable negative dentries on case-insensitive lookup Date: Wed, 19 Jul 2023 18:19:18 -0400 Message-ID: <20230719221918.8937-8-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719221918.8937-1-krisman@suse.de> References: <20230719221918.8937-1-krisman@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Gabriel Krisman Bertazi Instead of invalidating negative dentries during case-insensitive lookups, mark them as such and let them be added to the dcache. d_ci_revalidate is able to properly filter them out if necessary based on the dentry casefold flag. Signed-off-by: Gabriel Krisman Bertazi --- Changes since v2: - Move dentry flag set closer to fscrypt code (Eric) --- fs/f2fs/namei.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index bee0568888da..fef8e2e77f75 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -533,6 +533,10 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, err = f2fs_prepare_lookup(dir, dentry, &fname); generic_set_encrypted_ci_d_ops(dentry); + + if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) + d_set_casefold_lookup(dentry); + if (err == -ENOENT) goto out_splice; if (err) @@ -578,17 +582,6 @@ static struct dentry *f2fs_lookup(struct inode *dir, struct dentry *dentry, goto out_iput; } out_splice: -#if IS_ENABLED(CONFIG_UNICODE) - if (!inode && IS_CASEFOLDED(dir)) { - /* Eventually we want to call d_add_ci(dentry, NULL) - * for negative dentries in the encoding case as - * well. For now, prevent the negative dentry - * from being cached. - */ - trace_f2fs_lookup_end(dir, dentry, ino, err); - return NULL; - } -#endif new = d_splice_alias(inode, dentry); trace_f2fs_lookup_end(dir, !IS_ERR_OR_NULL(new) ? new : dentry, ino, IS_ERR(new) ? PTR_ERR(new) : err); @@ -641,16 +634,6 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) f2fs_delete_entry(de, page, dir, inode); f2fs_unlock_op(sbi); -#if IS_ENABLED(CONFIG_UNICODE) - /* VFS negative dentries are incompatible with Encoding and - * Case-insensitiveness. Eventually we'll want avoid - * invalidating the dentries here, alongside with returning the - * negative dentries at f2fs_lookup(), when it is better - * supported by the VFS for the CI case. - */ - if (IS_CASEFOLDED(dir)) - d_invalidate(dentry); -#endif if (IS_DIRSYNC(dir)) f2fs_sync_fs(sbi->sb, 1); fail: -- 2.41.0