Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2919871rwr; Fri, 21 Apr 2023 17:05:33 -0700 (PDT) X-Google-Smtp-Source: AKy350ZkwpmNHK3IESRmP8+HveM9QKE3ULyrbWCYoe4WMNDe95qbKDGxbXZTHGi8FDZWHM+VJZWt X-Received: by 2002:a17:90a:3487:b0:240:9ccf:41ff with SMTP id p7-20020a17090a348700b002409ccf41ffmr5794196pjb.49.1682121932693; Fri, 21 Apr 2023 17:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682121932; cv=none; d=google.com; s=arc-20160816; b=XfEi2xF9Jw1EWlhkVKupk6gGkw3YJJtxpysgVrcJg1w4//ExXCT466ytvbs4NXWgNr zt2nU+jA5MEnHFbGMtvhgUXjHBgEjomAiH9mRg2xWCWodscZmPCbR3KEZYDvxY192yLy w/4sNDRbYc9Lrm/+A7r/0xw1KuyP+4xEhz7eJMsefT4VZgPH+GYfMB3Sjngy1ZfeUkNj CBB1tLfdN3PEQRR46N9vdJb/Rqdh2Mu6aseu5IrRajacCchSxcPMxBbhkSxnS8Njy2rS pblkd4mqbIASduMbD8vktM5oL2DukR7LvIuGV6RlfjIk9lAOb2GUCn5shW0khjxaJN5R 4fRQ== 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=Rzm12Wf0/6hCs0KYH8kbSa1YHvd3ngMeVtyifiik2xE=; b=BzxBhupj264sIl8ZyBUbpDrzlH+CZA0rgUixjOGDAeFy5Kr+dnlVFFOXiHdpx/Okzd i8MALHpoAbGxZj3lbCxVCyMYHN8L+ghv7TSmzag7gaNWRgRwJhMJUds6Cp+goGUV06BE enWwpw8lxUbRwT1Eu7undcudzZNspUURTLi7XtkiwpOYN46cV60HtuK1yoM1BHQX7lFM 4qWLkycmO8VShUwYyLtZU1U539pOCApmvAK4bF2Lhkjl+f+fBNAUiBYDiV1OSa6/zefL vU8BMra3jjEwXFeaIiF+U2CrphdQTdpCWrIBClwxT2j4N+qNlqnqey67xnf1+MnO1xsi NdSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=wUZgAm4r; dkim=neutral (no key) header.i=@suse.de header.b=xmvEUsky; 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 140-20020a630292000000b0051b54dccffesi5111392pgc.714.2023.04.21.17.05.20; Fri, 21 Apr 2023 17:05:32 -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=wUZgAm4r; dkim=neutral (no key) header.i=@suse.de header.b=xmvEUsky; 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 S233863AbjDVADq (ORCPT + 99 others); Fri, 21 Apr 2023 20:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233881AbjDVADe (ORCPT ); Fri, 21 Apr 2023 20:03:34 -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 5ABC0272E; Fri, 21 Apr 2023 17:03:22 -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 0265E1FDC4; Sat, 22 Apr 2023 00:03:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1682121801; 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=Rzm12Wf0/6hCs0KYH8kbSa1YHvd3ngMeVtyifiik2xE=; b=wUZgAm4rni5TqadO1bQQSaocciuWgHYgirjNuPpEbuQiT5xW2Q2lWjzx/5yOP3EqkE0Nql EvcPemf2pxEf8+kZm4b1YNpkQx11qT8d4ZJuoijPbQ406PPs8d3n3CfPBp5IKlii9OQ0cn hZJyKDAtXG2FHdz+aBTyALHltzyHd58= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1682121801; 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=Rzm12Wf0/6hCs0KYH8kbSa1YHvd3ngMeVtyifiik2xE=; b=xmvEUskyL12a65ezpufXQPOU7t8x+vbfjSAUMCz5AhVUNeuCHRX0beCfUw5zBCT3WnHQvW RObzkarSkKy/ZtBw== 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 BDF521358E; Sat, 22 Apr 2023 00:03:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KvSmKEgkQ2TwdwAAMHmgww (envelope-from ); Sat, 22 Apr 2023 00:03:20 +0000 From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, brauner@kernel.org Cc: tytso@mit.edu, jaegeuk@kernel.org, ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, krisman@suse.de Subject: [PATCH v2 6/7] ext4: Enable negative dentries on case-insensitive lookup Date: Fri, 21 Apr 2023 20:03:09 -0400 Message-Id: <20230422000310.1802-7-krisman@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230422000310.1802-1-krisman@suse.de> References: <20230422000310.1802-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,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 --- fs/ext4/namei.c | 34 +++------------------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index a5010b5b8a8c..35f87f7141fe 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1850,16 +1850,9 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi } } -#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. - */ - return NULL; - } -#endif + if (IS_ENABLED(CONFIG_UNICODE) && IS_CASEFOLDED(dir)) + d_set_casefold_lookup(dentry); + return d_splice_alias(inode, dentry); } @@ -3185,17 +3178,6 @@ static int ext4_rmdir(struct inode *dir, struct dentry *dentry) ext4_fc_track_unlink(handle, dentry); retval = ext4_mark_inode_dirty(handle, dir); -#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 ext4_lookup(), when it is better - * supported by the VFS for the CI case. - */ - if (IS_CASEFOLDED(dir)) - d_invalidate(dentry); -#endif - end_rmdir: brelse(bh); if (handle) @@ -3296,16 +3278,6 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) goto out_trace; retval = __ext4_unlink(dir, &dentry->d_name, d_inode(dentry), dentry); -#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 ext4_lookup(), when it is better - * supported by the VFS for the CI case. - */ - if (IS_CASEFOLDED(dir)) - d_invalidate(dentry); -#endif out_trace: trace_ext4_unlink_exit(dentry, retval); -- 2.40.0