From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 424AFCCA483 for ; Wed, 22 Jun 2022 19:47:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359200AbiFVTrF (ORCPT ); Wed, 22 Jun 2022 15:47:05 -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 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@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