Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5873987ioo; Wed, 1 Jun 2022 14:39:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGtDZpuf7FR0b/Ham5s/vrGJ5161astCegZuuPeQK6scGzRsBRD6wtB4uuzTAWsh2iv1l7 X-Received: by 2002:a05:6a00:1351:b0:518:9fa0:fbe3 with SMTP id k17-20020a056a00135100b005189fa0fbe3mr1604840pfu.45.1654119555969; Wed, 01 Jun 2022 14:39:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654119555; cv=none; d=google.com; s=arc-20160816; b=lUJSWu2pdFVgRtJYEYjZjoA68g7d3Ryjftd6Vip25LBw8g4rOSlZQZoBSHwEeNyx06 NQempGWmKuGLpTmtnYN6eRgt4bMhHiHeYhHE2ikQWVj7F0PmB1HajQxRYTyKcoGb9u1D kNp9c6aivMKNiDcUhVDBuI1I/P0htC+7UONQWUU1ckQBwBJ3NeqJ6E/dhIiqpAL+ntMz u6qpfLI5AOyERR8JwMxR9y4XE95dmXGS0Ru9sNH5WIrWEHVjdbWv7gTp7xGBpvF2ih76 ggwtqMtihKStiFjQJ6KzDNJceIpRrLYsSelOSR0YmknfiR770dNX+MyFJwKx3HXeS8AK NESg== 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=bnce1kE7esaMucqzXjaZOV7uzfzoJyFdDzUfPSN4AW8=; b=ScEWGo6462YR6sB1V5r8wHo4SWS3GnRJ4anxnO2ChX52BvDUyyhk8igyM6gap1TCDv DCmaeYpOavPp9Z9EfkPy8IIV/YM/VmG0oBWhDKFMo3tqDAOznVGwP0W207w8z8ijrSwn 6WhjjNBKZykI6RVh9qvWYJIuYY50xxuEv/6e6leU+lRjidK9P+zDtGiLV/NxPrVwnLPn 9q1v7vjX7ckotA4bYrJmMkSkUmX6tPYOcDTwPI1waBG9b3QSiHe3wE0HMvb5xMUKnwJE 1LlJEtqHv8ZoiYlyo0H5k09054Dnrf2gJaJIHKlGur+dsTM/JqOmRGoNbdk53vhcbJSG HR9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Gu2U+x1x; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c26-20020aa78e1a000000b0051b46ca9ca0si3171860pfr.119.2022.06.01.14.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 14:39:15 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Gu2U+x1x; spf=softfail (google.com: domain of transitioning linux-ext4-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 76795274D7E; Wed, 1 Jun 2022 13:49:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbiFAUsq (ORCPT + 99 others); Wed, 1 Jun 2022 16:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230135AbiFAUsF (ORCPT ); Wed, 1 Jun 2022 16:48:05 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F372C27F8B2; Wed, 1 Jun 2022 13:45:08 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id E34211F4398A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1654116303; bh=EYpe7jq8IZWr8tink05axuBf87GgQR+c3mze25uRf3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gu2U+x1xr9c68jrHWXNn9eK1h9sFH7RfO+WWdoaw+vkefkr38W4doINXmEvoPn1hF HJfJBJPf9iSbKwIETQtwBHyaJieDSdQi1hcifoJVebxIlltN3BT5yN/ftwK3zBajJV m37KAbWpRVzhxtbWir2I1V70xgAx5OVPomi6LYsh3/w/1c257PBAeWSORU0JSj6kPm Vwo31RfttlP7sa2Y1fPWWM7wOX9JNlEHiUdsQPn3SiyRQAYU1f7NtG7ZqN5wIaD1X4 S4yvqr7NkQy7u1+NwemQVm0aWqY2s0QthVcsV6y8UeMPCk/sT/DyB6bcrq+CzuIJy5 SOei/Uj4PJ/4A== 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 RFC 6/7] ext4: Enable negative dentries on case-insensitive lookup Date: Wed, 1 Jun 2022 16:44:36 -0400 Message-Id: <20220601204437.676872-7-krisman@collabora.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220601204437.676872-1-krisman@collabora.com> References: <20220601204437.676872-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=no 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 767b4bfe39c3..783ba0b186c1 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1800,16 +1800,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); } @@ -3126,17 +3119,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) @@ -3231,16 +3213,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