Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5144095iog; Wed, 22 Jun 2022 13:00:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v05BiADP74WhHo2pzAGFv1wO6ww32ldghSCGz0RYba8VxeH5zXrRnQE2UOMYzFj6fi4fU7 X-Received: by 2002:a17:902:dac5:b0:163:ffbc:4f55 with SMTP id q5-20020a170902dac500b00163ffbc4f55mr34949910plx.61.1655928004660; Wed, 22 Jun 2022 13:00:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655928004; cv=none; d=google.com; s=arc-20160816; b=eKphasb96ns3ThSy+1dKJv3Pg5Cq8LZpch6GwM40gCqFSdy2FVZqtf56jEaSE8DNk7 GHC8oc5wEerAwqs03KKXSQf7AptoLxxB4Sfdv3Vep5Xj1PQFj2jEBrP1NcGXN7jCBtno 4Ur8bSgh9BHpRaB3OjkQmA1mUiF9ofmoB7V6nTl3DFzvjBnj6MtlQW4t4GhO0xjeuibb C4HqImE/UZPBcm/CLmmiV226FkVU+6+/5azU4PB3fl3fX7uznrjbaIUXLAA7DGcLse8R S3aJThRcuJNoennWQM0Bx5FCFuUhjS1nsQCgwI2gyjSBGkuq6NMTXexmHVPCAIsB/BON duDw== 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; bh=nmq7Sbkx7hOxTwpKpBxnMveyL8Lk5p+nkDPXuq+qCgo=; b=fABreXCcpSdHeQpIcKvB9zENFKCGLfPCUMV65B4TFLYrF70znSKIyeNJGJ7F2ez9RJ W+8hEsksOnOBkZ1Ded7BSss+EUnz5NbWlic8NAbLFMX45TgbZux+JlBE6b5+jJzgUrHs ta5hEE13wvB+BTlIyOrcfbvcuMa5kEvOHd7TJMaPc3whhmWdok04TmGlXfjDbAQychZ/ 4Cd7rDJZcdCp4aWA1nWAJLXH+kVvx07lfkhEzGJLRVqlri7vvwDiQxZJcBAW3hxndmNr Zml8ARodar/kUwXfCZwUdXgnUf+RlGDccQMrXMuBNYnUG3Xo6tAUjQcsou0SE6OGhK4X e3TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="m/VJuWpy"; 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=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902b40800b00168f3798c90si6884919plr.402.2022.06.22.12.59.50; Wed, 22 Jun 2022 13:00:04 -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=@collabora.com header.s=mail header.b="m/VJuWpy"; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376529AbiFVTrE (ORCPT + 99 others); Wed, 22 Jun 2022 15:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376561AbiFVTqf (ORCPT ); Wed, 22 Jun 2022 15:46:35 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E3C3FDAF; Wed, 22 Jun 2022 12:46:34 -0700 (PDT) Received: from localhost (mtl.collabora.ca [66.171.169.34]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: krisman) by madras.collabora.co.uk (Postfix) with ESMTPSA id 9A60F6601792; Wed, 22 Jun 2022 20:46:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1655927192; bh=jr1PLvBeYw9L3vR6W9Tgk30AQ9z5XsfAJUVUW45rF34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/VJuWpysiUHcNoftR+IAL2jTM48H9JDP013vw9p8nw7Ir3kM366MRfaqa8S+krJ2 JggwS+CQinefuG67Hu89cWIlkPQHWQQDXOisj0o2RXBpkmlSIAJW7GDJGfTPixaBDy pJYTnz3lkT/zLF/YFnsKnDU3x13MtsJTgvPE4PD2Z07/XrED3HBHHdR9cwWjSQm76d 3mgVs5t5fWvKaGJt4L7kj+KcIzSGOO4S349Ztpkq8R39CfPLF4QOEcgds//+l0SueZ HgMZrkKaqCMu6XWk/v5fHxwK270wCu8UxMUQ6y4jTIqkbW3Gk35JOo1GXol/aeNGKu UGqHXPkuFop/Q== From: Gabriel Krisman Bertazi To: viro@zeniv.linux.org.uk, tytso@mit.edu, jaegeuk@kernel.org Cc: ebiggers@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH 6/7] ext4: Enable negative dentries on case-insensitive lookup Date: Wed, 22 Jun 2022 15:46:02 -0400 Message-Id: <20220622194603.102655-7-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220622194603.102655-1-krisman@collabora.com> References: <20220622194603.102655-1-krisman@collabora.com> 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,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 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 | 35 ++++------------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index db4ba99d1ceb..9908ad6cb071 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1823,16 +1823,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); } @@ -3153,17 +3146,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) @@ -3258,16 +3240,7 @@ static int ext4_unlink(struct inode *dir, struct dentry *dentry) retval = __ext4_unlink(handle, dir, &dentry->d_name, d_inode(dentry)); if (!retval) ext4_fc_track_unlink(handle, 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 + if (handle) ext4_journal_stop(handle); -- 2.36.1