Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp727825pxf; Wed, 24 Mar 2021 14:36:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD0ilTAD99w+yp6o5RrYML92za7aRSpYlX68Ov59ORZIFTK7iJyEB3WPz3S3k6UtTJN8YK X-Received: by 2002:a05:6402:1713:: with SMTP id y19mr5646578edu.52.1616621780737; Wed, 24 Mar 2021 14:36:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616621780; cv=none; d=google.com; s=arc-20160816; b=mbE0bU9ytIldpYCD0FTjPVx6XZOLM7N+HSAIy8R/Z4S6cRaMEm3ObaDNdHCgit38kd P8l/Q+jX1ir4fG1duJ8kwFM0IGCx22yuBfXwEezwq2SnMHMBdPQk04lXFVYOrnoDoOAv dxurcNFHTux6pSXogimG3+6G3/VZKXkdhvfkFX7hWRBOZh1uyTQYquSCiCQcEi33Qet2 QTQ5M7e8L1EcgeZaoc2UoxPRv4dX2gmy6Mim0+oR0ywdj+oxPWvSG33Wi7u20Kf2AbI0 D4B/xwB6WNrUwT3Bsm4i9CZLC9aDl1JrlU6OklYEfWE10/9SbpAA1mYdonD3GlrvLK56 1iUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=oFmGUGireB7nbwdHCJWCJCQOer3trGFbH8GbC6B391A=; b=BoxvMzsW/xUc8a+QbZ6yvrre+RAzGHXynB+uPPt8oe6sPFeDWknS7QuinxAtOOQqH0 DRI8zifVqC08oN60UreKpzY7R0uPXeSYh8OOR7hWK/gY9Qi+jnsIbWwWI/uDAqzOYeuw iDz+YIN6xm/r3QquiOJ4kjF0i5eyk+uGpYgfKK3YjoKXzLfz9OTrjVb4qqPnbca6rYE1 TG6sZ/EhfcOzt8YCm5P3GoMQ6lyTlX1h9BaE86uQcbYRVINlo2yaH9fHa1dHXR0/iD1e 4crwOdVbJjY5ZiJStpZEwIFyDwHesQLNyR6i6/eWL/waWAubc58XV9tpbv921Nwqrs+A uJvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm15si2764185ejc.270.2021.03.24.14.35.57; Wed, 24 Mar 2021 14:36:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbhCWXXd (ORCPT + 99 others); Tue, 23 Mar 2021 19:23:33 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:36376 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbhCWXX2 (ORCPT ); Tue, 23 Mar 2021 19:23:28 -0400 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 Content-Transfer-Encoding: 8bit In-Reply-To: <20210323195941.69720-3-andrealmeid@collabora.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 04:59:39PM -0300, Andr? Almeida wrote: > * dcache handling: > > For a +F directory, tmpfs only stores the first equivalent name dentry > used in the dcache. This is done to prevent unintentional duplication of > dentries in the dcache, while also allowing the VFS code to quickly find > the right entry in the cache despite which equivalent string was used in > a previous lookup, without having to resort to ->lookup(). > > 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. > > For now, negative lookups are not inserted in the dcache, since they > would need to be invalidated anyway, because we can't trust missing file > 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() 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...