Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1345072rdg; Fri, 11 Aug 2023 19:58:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLSvsYc7igxkXUYzy3XPkiXC0FfyNomvgnG5Cc9Dw+QuKo17Qv113kHMMRLFciGGMQyGRq X-Received: by 2002:a05:6808:1491:b0:3a7:9acc:4725 with SMTP id e17-20020a056808149100b003a79acc4725mr5314162oiw.54.1691809079823; Fri, 11 Aug 2023 19:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691809079; cv=none; d=google.com; s=arc-20160816; b=h4PXcsfdZrMNevE7NNdFeq5TnrLJz4TbkyJtYAp+9m6qyYLWNn8L9TRoCJmRuQfsZI FgK2D2x5YxJnvHdmN4WTfe+1CEBoHv7dM22jXdxBqe8fLf9eeubYHac2eCr6f4vvytF1 qLFz9/vj5Th2hm+EN86ieP8nh+B5HpmiDARu9ZnrrB0gA7Z5FQqGoQy0vxOH7WqI18Rk pl2WIk9AtktubeV4wmD8EJU3fs6myigU2OiPhjsqbQuVEZjsM/wmNNYf8K+kP+wyO9GU 8fpA8JXhizhFZ+sPyx6LnUNnUddvyXwIz+Q/OnGqqHv24Z1qINHAPUxPHBbgXa40gXtR WAMQ== 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=L5yvPO73LzaHqBcXpBIAiP4zUC13otTzpIxPlCrbM0w=; fh=HFDFbc5lRXwuu0vgGURCiLYm5ywsvQKdSNBX4pGxTs4=; b=VDkpp+6BhYSy7EuuGDfWxlkzwRugkadwKZITz3+9WiFud4FeRPDWvghKkjeig9tvXI XNpT4IzyHmHwIn2ZMGtqf4xi7Lq9FDcYc8dUOSOCLW6bqmY0PJZygwFO9DbhUO/UvCwn /rwXTpuwz5ZMYh41hug6dzlZtPe0KbWTq7gWIWXMeQ6cquMm9W53HT5qs6NqJiJcHusb lEONFOThVO87FRahpipu2j/PffkebP65PpcKjvpRHbwiHhabYqrENPBw1Yd+zn0OoJ9b tvqY4MvW0n9RUdkF06OZus9Xgki6KyWIkvLYoJ7YBV6NcThTTsG0yhQs0Z69o978V0To TiXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=EC5YeMNQ; dkim=neutral (no key) header.i=@suse.de; 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 o16-20020a634e50000000b005648d3f2031si4177835pgl.362.2023.08.11.19.57.46; Fri, 11 Aug 2023 19:57:59 -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=EC5YeMNQ; dkim=neutral (no key) header.i=@suse.de; 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 S234588AbjHLAma (ORCPT + 99 others); Fri, 11 Aug 2023 20:42:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237108AbjHLAm0 (ORCPT ); Fri, 11 Aug 2023 20:42:26 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E85D359C; Fri, 11 Aug 2023 17:42:12 -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 08BE71F8A8; Sat, 12 Aug 2023 00:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691800931; 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=L5yvPO73LzaHqBcXpBIAiP4zUC13otTzpIxPlCrbM0w=; b=EC5YeMNQ/omLqYo3av20mJjbh2k9LNK3IowuC5aGboOKni0JgVY0XdN+JsXculijkeU6AQ wFrmg9U/6BtZtKHE1Fm/3j5VGcQcnmSsNOAFDyJiRJrKm+cNyE83HrLKFXC2r/S0nsG5Hk kYDPkWCHU/IbvMOHcdK6+QRXeFSmh5w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691800931; 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=L5yvPO73LzaHqBcXpBIAiP4zUC13otTzpIxPlCrbM0w=; b=srTz7A4/LrUIT2+9dba0oswQ9yiNsW3LG/0YeGeNvlnbmh1sVQ5IQe1qftybeASOvqgoKI V+g8b9b/bPhCymDg== 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 BA50113592; Sat, 12 Aug 2023 00:42:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id duukJ2LV1mQ1EAAAMHmgww (envelope-from ); Sat, 12 Aug 2023 00:42:10 +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 v5 10/10] f2fs: Enable negative dentries on case-insensitive lookup Date: Fri, 11 Aug 2023 20:41:46 -0400 Message-ID: <20230812004146.30980-11-krisman@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230812004146.30980-1-krisman@suse.de> References: <20230812004146.30980-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,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 v4: - Use helper to decide if should set dentry flag. 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..8b8fd4cdf62d 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 (dir_is_casefolded(dir)) + d_set_casefolded_name(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