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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 965F2C433F5 for ; Tue, 22 Mar 2022 20:37:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C891F6B0071; Tue, 22 Mar 2022 16:37:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C10AB6B0072; Tue, 22 Mar 2022 16:37:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A8AD86B0074; Tue, 22 Mar 2022 16:37:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0186.hostedemail.com [216.40.44.186]) by kanga.kvack.org (Postfix) with ESMTP id 93B796B0071 for ; Tue, 22 Mar 2022 16:37:39 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 466898249980 for ; Tue, 22 Mar 2022 20:37:39 +0000 (UTC) X-FDA: 79273183038.19.DB86472 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf10.hostedemail.com (Postfix) with ESMTP id 240FDC0036 for ; Tue, 22 Mar 2022 20:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dv5mPsrTFDOdECSclyFGEOSyR54CIbYfgKo9WOCShhY=; b=VKNujyJH2KnwzcEIlFNkwphEUC Ydu9kgNm0CYYte6Py4ib0P9egATdn1S4INBnXa5xkMORWQzIZPO1C1wP/emrlypbz8l5ym39K8T0Z ZV7JQEdb47bC/ZuLWs9HYEy5tpIGHB8NjbeaosUz+QDzDiDLHzLctwHLw8vMk2t2kuq1gDXJ49eqA zf0TPvV7cYIaEMFys9f258D87wJttsxd2Dy1biwDC0GUzJDUoxa+OIoXj5kvJQ/fnBx8y07DR4IGg ni9rIoRqqv83yBl0tGLQQ05HfQKQjPeiSAScTpT3n0ZDMmURqfbJpr6OZBNaJ0dB8hlvEyD7oGoKz OwgcLmSg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWlFq-00Bv1O-0c; Tue, 22 Mar 2022 20:37:22 +0000 Date: Tue, 22 Mar 2022 20:37:21 +0000 From: Matthew Wilcox To: Colin Walters Cc: James Bottomley , Dave Chinner , Roman Gushchin , Stephen Brennan , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Gautham Ananthakrishna , khlebnikov@yandex-team.ru Subject: Re: [LSF/MM TOPIC] Better handling of negative dentries Message-ID: References: <20220316025223.GR661808@dread.disaster.area> <42d92c6f-28f2-459b-bc2a-13dd655dd4ae@www.fastmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42d92c6f-28f2-459b-bc2a-13dd655dd4ae@www.fastmail.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 240FDC0036 X-Stat-Signature: ai9k4664dx7735dhg3tpb69pee1drnm9 X-Rspam-User: Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=VKNujyJH; dmarc=none; spf=none (imf10.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1647981457-696120 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 22, 2022 at 04:17:16PM -0400, Colin Walters wrote: > > > On Tue, Mar 22, 2022, at 3:19 PM, James Bottomley wrote: > > > > Well, firstly what is the exact problem? People maliciously looking up > > nonexistent files > > Maybe most people have seen it, but for those who haven't: > https://bugzilla.redhat.com/show_bug.cgi?id=1571183 > was definitely one of those things that just makes one recoil in horror. > > TL;DR NSS used to have code that tried to detect "is this a network filesystem" > by timing `stat()` calls to nonexistent paths, and this massively boated > the negative dentry cache and caused all sorts of performance problems. > It was particularly confusing because this would just happen as a side effect of e.g. executing `curl https://somewebsite`. > > That code wasn't *intentionally* malicious but... Oh, the situation where we encountered the problem was systemd. Definitely not malicious, and not even stupid (as the NSS example above). I forget exactly which thing it was, but on some fairly common event (user login?), it looked up a file in a PATH of some type, failed to find it in the first two directories, then created it in a third. At logout, it deleted the file. Now there are three negative dentries. Repeat a few million times (each time looking for a different file) with no memory pressure and you have a thoroughly soggy machine that is faster to reboot than to reclaim dentries.