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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 601ACC433EF for ; Tue, 22 Mar 2022 20:37:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234139AbiCVUjI (ORCPT ); Tue, 22 Mar 2022 16:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234105AbiCVUjH (ORCPT ); Tue, 22 Mar 2022 16:39:07 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB18561A21 for ; Tue, 22 Mar 2022 13:37:36 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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.