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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEBDBC433DB for ; Tue, 23 Mar 2021 23:21:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0B5DA619E2 for ; Tue, 23 Mar 2021 23:21:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B5DA619E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 584B68D0022; Tue, 23 Mar 2021 19:21:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E8858D0012; Tue, 23 Mar 2021 19:21:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AEAA8D0022; Tue, 23 Mar 2021 19:21:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0128.hostedemail.com [216.40.44.128]) by kanga.kvack.org (Postfix) with ESMTP id 1BED68D0012 for ; Tue, 23 Mar 2021 19:21:16 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D4A2212E2 for ; Tue, 23 Mar 2021 23:21:15 +0000 (UTC) X-FDA: 77952712110.27.06576CE Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [142.44.231.140]) by imf08.hostedemail.com (Postfix) with ESMTP id 4E0CE80192DD for ; Tue, 23 Mar 2021 23:21:14 +0000 (UTC) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOqIe-008gcD-SL; Tue, 23 Mar 2021 23:19:01 +0000 Date: Tue, 23 Mar 2021 23:19:00 +0000 From: Al Viro To: =?iso-8859-1?Q?Andr=E9?= Almeida Cc: Hugh Dickins , Andrew Morton , krisman@collabora.com, smcv@collabora.com, kernel@collabora.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Rosenberg Subject: Re: [RFC PATCH 2/4] mm: shmem: Support case-insensitive file name lookups Message-ID: References: <20210323195941.69720-1-andrealmeid@collabora.com> <20210323195941.69720-3-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20210323195941.69720-3-andrealmeid@collabora.com> X-Stat-Signature: at19dwobq1fscw19zxpirp3fo4mzfnqr X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4E0CE80192DD Received-SPF: none (ftp.linux.org.uk>: No applicable sender policy available) receiver=imf08; identity=mailfrom; envelope-from=""; helo=zeniv-ca.linux.org.uk; client-ip=142.44.231.140 X-HE-DKIM-Result: none/none X-HE-Tag: 1616541674-604813 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Mar 23, 2021 at 04:59:39PM -0300, Andr=E9 Almeida wrote: > * dcache handling: >=20 > For a +F directory, tmpfs only stores the first equivalent name dentry > used in the dcache. This is done to prevent unintentional duplication o= f > dentries in the dcache, while also allowing the VFS code to quickly fin= d > the right entry in the cache despite which equivalent string was used i= n > a previous lookup, without having to resort to ->lookup(). >=20 > d_hash() of casefolded directories is implemented as the hash of the > casefolded string, such that we always have a well-known bucket for all > the equivalencies of the same string. d_compare() uses the > utf8_strncasecmp() infrastructure, which handles the comparison of > equivalent, same case, names as well. >=20 > For now, negative lookups are not inserted in the dcache, since they > would need to be invalidated anyway, because we can't trust missing fil= e > dentries. This is bad for performance but requires some leveraging of > the VFS layer to fix. We can live without that for now, and so does > everyone else. "For now"? Not a single practical suggestion has ever materialized. Pardon me, but by now I'm very sceptical about the odds of that ever changing. And no, I don't have any suggestions either. > The lookup() path at tmpfs creates negatives dentries, that are later > instantiated if the file is created. In that way, all files in tmpfs > have a dentry given that the filesystem exists exclusively in memory. > As explained above, we don't have negative dentries for casefold files, > so dentries are created at lookup() iff files aren't casefolded. Else, > the dentry is created just before being instantiated at create path. > At the remove path, dentries are invalidated for casefolded files. Umm... What happens to those assertions if previously sane directory gets case-buggered? You've got an ioctl for doing just that... Incidentally, that ioctl is obviously racy - result of that simple_empty(= )=20 might have nothing to do with reality before it is returned to caller. And while we are at it, simple_empty() doesn't check a damn thing about negative dentries in there...