Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp178609rwb; Thu, 27 Jul 2023 11:02:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFrerQvsLgol7805lOlR4AuI9WrvkbTxGr4VNmTNxhWLxEhvjEUXmJGwDCLIKr2nhFg6aGz X-Received: by 2002:a17:906:3053:b0:988:71c8:9f3a with SMTP id d19-20020a170906305300b0098871c89f3amr103873ejd.16.1690480943404; Thu, 27 Jul 2023 11:02:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690480943; cv=none; d=google.com; s=arc-20160816; b=NFCN5kiMXS7g1E5yHrq+13fy+N6Uvvt425OkuJeo4tiiAAGA+z7XO/BZPwSXBvCqx4 Uj9vLoi0GDzdb6nMEBXBn9xtePvQ7ZV+ZrCMJaU1UzYAWlS7o2lABU/j/0BF2laOHS0Z GGOzpipIqLhZLXxZ8w+3JibAdmcf4J5JNNdr12vU4ShT6tJsluOqAdIk8qFbC1mQ+JiK WO3vNxtHpry96AUs5w1a8CpzdZMOmfkYl57zfM5o4OxnqZbrpZ3U9owDlvsltUav4IR+ D6CtiK91DdhzYGSJwYj7gm8RPp+9ezOtcIsnWQAowNxqgLrze6PVjrkk3bqhsWcBoTcG DVaA== 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=hZggOqa9oLaxUAHiYHqOnhFRC6l4n1oINBTdrX/kUYNOYoq0ZCO1qt7A0aZrT1kFBQ G8k2OMGAvIKDQ5KjzsgQEQQWmW3AbnmssFfOvM3PEKmK3tfFGuqJoZjX7eFcBXH0XEMl o1/gDrpCk2qHRfpKQf/puS/dHC5tVNWJZELuw5sQwWwXpYY/HJIRhIltWLQ9hi4hxpuu hebG8kCO3i+U4qSFAinGzmRZQ6zWVqmmxZRVEGwQZsjGVkCWv6EVJiEdZ0qgjWllmmn8 /Ihw+So0EuC83kbWTk7AXCrAkL9D99XW2bFQUuSgnCpwMM9j2EqAS99EPrZk3vtWIqOh bTWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=T5+9oXZM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SUMBGdvO; 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 dk8-20020a170906f0c800b0099364d9f0e7si1243181ejb.543.2023.07.27.11.01.35; Thu, 27 Jul 2023 11:02:23 -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=T5+9oXZM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=SUMBGdvO; 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 S229957AbjG0R3H (ORCPT + 99 others); Thu, 27 Jul 2023 13:29:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232394AbjG0R3C (ORCPT ); Thu, 27 Jul 2023 13:29:02 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C3AD2D67; Thu, 27 Jul 2023 10:29:01 -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 CB67D1F891; Thu, 27 Jul 2023 17:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1690478939; 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=T5+9oXZM7VOYWkbVVSZ+cRiransKqUWFd2gr/Ax2T1XFDJWyi/5dbpmunhfCttK3UgBkfS ZZG4E93MFr6PIGLl8K8XrMMlUpLxFRswWGEEI/U7cvH/EmSxB9Zs7t3TmE6DXJG26RU7Q4 hmKDkPLjLhi2gWewEWzcz3Ooi6tNtGo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1690478939; 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=SUMBGdvOPU1uHLgfSiOvSD5GXQd4vwaVukDnFicXj8AZb+HA8GWxYGiqW3pNhbMz+JA/zV 0AwSo96ss7oJHBCQ== 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 939A213902; Thu, 27 Jul 2023 17:28:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 1ylWHlupwmTdaAAAMHmgww (envelope-from ); Thu, 27 Jul 2023 17:28:59 +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 v4 7/7] f2fs: Enable negative dentries on case-insensitive lookup Date: Thu, 27 Jul 2023 13:28:43 -0400 Message-ID: <20230727172843.20542-8-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230727172843.20542-1-krisman@suse.de> References: <20230727172843.20542-1-krisman@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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