Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp889708rdh; Thu, 23 Nov 2023 23:49:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IErWiUEnxyg67sdTo/MA16702Q43Q8WrJDE8jy+jhSjBjrhRVK9enNffGSDlt+3TA0rCGz3 X-Received: by 2002:a05:6e02:1585:b0:35b:37a:52e5 with SMTP id m5-20020a056e02158500b0035b037a52e5mr2653404ilu.31.1700812153406; Thu, 23 Nov 2023 23:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700812153; cv=none; d=google.com; s=arc-20160816; b=T2rQMWrNr1lHEtx9INGtkQmet6xKV6b+Kp8LZqkCFvomdL7TvIwRDZV2tYQR3g2ul6 hYlkIQlVAQthBZurZsNp0ajuSB5jQXxYl4C/PfCzb16Q8p51TzP5HKBIRjuERBhuMP55 Nc/Y7y7K/aDgM9oDHxIlsKlINWbZlrZ/eqVkMzLvgd4R6iH3TvRlGZA0Ub6Jyqmt2GCL kmb2RXvuuPXLZxA761lGx49ieYqEmjRbVtYhSlkfzJ3sCCDkzf1OCWVjlcJE7H1fjeXh Fhqui9YQHYsIC7Es9RhtJeKFv+zSXzqXwSXxCVFZEf/L+WbV49uMS0/UxpsCpI/cD6k+ nb9w== 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-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=28ZlngaXvYd70NmiLVOgj+NejQ6ZUD3E3kKj3Lcl1lE=; fh=GYvd9BZ3aSs0QU/4ATnn3OWljUnuk7YlQaQDMKfsmxk=; b=AnK3xLbE6JLQN8b9iDgXRtPBlS855wmflsaqLm5Yc2ncLPRgTjkAuvfWj61Q23pDgr uIKtc5VRRyVj4oyvieMH8WPZ/96MV5rfeZwKsGvkUCHyXD17hAR7soADJTCwTM9vAWBp XTYOEFhBBH+YWisTHlOGfoSPS12B1vGYbLusEvhfnUIqG/xBSLfRv5zKkS/526b2ThNA I/rsUyKsmwCBMp5ATKAzxgjZY7FyOpXWy5PJ/Jdf7r3yslVfe+uLORrcQ1JBjpZ2Go7i EDk4VdY7AecOfM1PH4aCtKNGiTKdO0FCwVkJzpwUsYwPdVr+IAMiGV/IcX87sHqflDbx hc+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=TdTMLY1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id e25-20020aa79819000000b006c320b9a1d2si2776625pfl.110.2023.11.23.23.49.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 23:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=TdTMLY1k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 9373482E4824; Thu, 23 Nov 2023 23:49:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjKXHsz (ORCPT + 99 others); Fri, 24 Nov 2023 02:48:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230245AbjKXHsx (ORCPT ); Fri, 24 Nov 2023 02:48:53 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDE4DD73; Thu, 23 Nov 2023 23:48:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=28ZlngaXvYd70NmiLVOgj+NejQ6ZUD3E3kKj3Lcl1lE=; b=TdTMLY1k87Tw14a+6kU+4Ty53L p+L5YjjM9q52xjNsO4xcLYPGjwx7N6B2y1D04waeHJNrPkJeWNx0NWNOjDJxP8VqFBfbRD5F9nwZg xKS0tJ/Qb1ThAcYhyWszcL4I0uzxTxLKtymx3zDtErFZ9tyCjC1S0g7gB/f/ncYV+iMVAs8d28mmD 0gdJ8poMY+wj3EP1zIo6JVV/DqMXaqQrULYsXLrMcQS2XC+oEED3RiA/vo2RqED1nq5WjBo/25O7X U387UjiprwRrJMZws3Bz7ijxgd1EHyBANKHm8JrSUFzkcYD4VKE2reC057MlHFdPtsMr80kc+YHAw BpdYQYlg==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r6Qvp-002RzH-07; Fri, 24 Nov 2023 07:48:57 +0000 Date: Fri, 24 Nov 2023 07:48:57 +0000 From: Al Viro To: Cedric Blancher Cc: linux-fsdevel , Linux Kernel Mailing List Subject: Re: d_genocide()? What about d_holodomor(), d_massmurder(), d_execute_warcrimes()? Re: [PATCH 15/20] d_genocide(): move the extern into fs/internal.h Message-ID: <20231124074856.GA581958@ZenIV> References: <20231124060553.GA575483@ZenIV> <20231124060644.576611-1-viro@zeniv.linux.org.uk> <20231124060644.576611-15-viro@zeniv.linux.org.uk> <20231124065759.GT38156@ZenIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231124065759.GT38156@ZenIV> Sender: Al Viro X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 23 Nov 2023 23:49:10 -0800 (PST) On Fri, Nov 24, 2023 at 06:57:59AM +0000, Al Viro wrote: > > > +extern void d_genocide(struct dentry *); > > > > Seriously, who came up with THAT name? "Genocide" is not a nice term, > > not even if you ignore political correctness. > > Or what will be next? d_holodomor()? d_massmurder()? d_execute_warcrimes()? > > kill_them_all(), on the account of that being what it's doing? To elaborate a bit: what that function does (well, tries to do - it has serious limitations, which is why there is only one caller remaining and that one is used only when nothing else can access the filesystem anymore) is "kill given dentry, along with all its children, all their children, etc." I sincerely doubt that you will be able to come up with _any_ word describing such action in any real-world context that would not come with very nasty associations. Context: a bunch of filesystems have directory tree entirely in dcache; creating a file or directory bumps the reference count of dentry in question, so instead of going back to 0 after e.g. mkdir(2) returns it is left with refcount 1, which prevents its eviction. In effect, all positive dentries in there are artificially kept busy. On rmdir(2) or unlink(2) that extra reference is dropped and they get evicted. For filesystems like e.g. tmpfs that's a fairly obvious approach - they don't *have* any backing store, so dcache is not just caching the underlying objects - it's all there is. For such filesystems there is a quick way to do an equivalent of rm -rf - simply go over the subtree you want to remove and decrement refcounts of everything positive. That's fine on filesystem shutdown, but for anything in use it is *too* quick - you'd better not do that if there are mountpoints in the subtree you are removing, etc. At the moment we have 3 callers in the kernel; one in selinuxfs, removing stale directories on policy reload (not quite safe, but if attacker can do selinux policy reload, you are beyond lost), another in simple_fill_super() failure handling (safe, since filesystem is not mounted at the time, but actually pointless - normal cleanup after failure will take them out just fine) and the last one in kill_litter_super(). That one is actually fine - we are shutting the filesystem down and nobody can access it at that point unless the kernel is deeply broken. By the end of this series only that one caller remains, which is reason for taking the declaration from include/linux/dcache.h to fs/internal.h - making sure no new callers get added. Not because of the identifier having nasty connotations, but because it's pretty hard to use correctly.