Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp374440yba; Wed, 3 Apr 2019 10:20:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS2FIiAhDQwb3rrD9FHW/Pv4IRIpelTD886g4YmPUSlrlFmLndfKU/qNMobW9C6QYHhSHY X-Received: by 2002:a17:902:2947:: with SMTP id g65mr1135256plb.258.1554312038022; Wed, 03 Apr 2019 10:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554312038; cv=none; d=google.com; s=arc-20160816; b=NT/aP1LJCCmob21kJZON607t+LMq0SneHUO3hv3iTeGgzAxa1dRTneSMKTP4yf5Gf/ Y1evjfNi3hQ8OAZo1QeNttzO+oz9r/NIyLpexEnkZ3+dIgFw0DDW+OaQguav4uXKR9Av bBIBUVI3ATmm1hKnSRcPKFre35s4nNI8iVi+KMcX0kkkp+ihXJKikp+lw8tGmEYgW5Y7 1MaqdCPGiPrcNr2eoOoHlFPEEFuCfjhtwm0bYmvGNBFOPUk7SykXhDRsfLvj12/8NEVR VieBn9NqBzWKbcsHPO+AKS8bX22FrBEHMtZ/PLiFmZ5a+If1yWKTjhhC3GjpLWOHQgp1 vbeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Nrovqt/E3sLIY0UINWIZm4LZjlIUz46vFJMaX0OPy6U=; b=UGDvNlTqPan/e/DA8plI40hxYZWvqFw9cdqhKRtqepdhyHit1nTZqDcG6ZOJhxwaJX A+N4LxZLZF6ZIvD0F9dp9MDxiwebRlXUijoZUBaQSZ1003ipyQpje5S6xCNr7mIXrBUK aXnE0Tlfi101MtQsx5z8NUzGQIg0+JODJs9DPXL1kDql73uVdTtl1fApj+kptThaPkyk klS27iAfaaCYjSz05BxGSHtEubPR2iLD3WmbbqQ/cd2XYFnY0DG4aYkI0gbN21u8d72u V58gFIAcICUp8SNdb9V/vCPY4mPFUxbcaATmvWuDEpOptyWxuvLk5JVpIFAeLvMoB0IV itbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m88si1144423pfi.280.2019.04.03.10.20.22; Wed, 03 Apr 2019 10:20:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726524AbfDCRTm (ORCPT + 99 others); Wed, 3 Apr 2019 13:19:42 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:33830 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbfDCRTl (ORCPT ); Wed, 3 Apr 2019 13:19:41 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hBjXl-000498-1C; Wed, 03 Apr 2019 17:19:21 +0000 Date: Wed, 3 Apr 2019 18:19:21 +0100 From: Al Viro To: "Tobin C. Harding" Cc: Andrew Morton , Roman Gushchin , Alexander Viro , Christoph Hellwig , Pekka Enberg , David Rientjes , Joonsoo Kim , Christopher Lameter , Matthew Wilcox , Miklos Szeredi , Andreas Dilger , Waiman Long , Tycho Andersen , Theodore Ts'o , Andi Kleen , David Chinner , Nick Piggin , Rik van Riel , Hugh Dickins , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [RFC PATCH v2 14/14] dcache: Implement object migration Message-ID: <20190403171920.GS2217@ZenIV.linux.org.uk> References: <20190403042127.18755-1-tobin@kernel.org> <20190403042127.18755-15-tobin@kernel.org> <20190403170811.GR2217@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190403170811.GR2217@ZenIV.linux.org.uk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 03, 2019 at 06:08:11PM +0100, Al Viro wrote: > Oh, *brilliant* > > Let's do d_invalidate() on random dentries and hope they go away. > With convoluted and brittle logics for deciding which ones to > spare, which is actually wrong. This will pick mountpoints > and tear them out, to start with. > > NAKed-by: Al Viro > > And this is a NAK for the entire approach; if it has a positive refcount, > LEAVE IT ALONE. Period. Don't play this kind of games, they are wrong. > d_invalidate() is not something that can be done to an arbitrary dentry. PS: "try to evict what can be evicted out of this set" can be done, but you want something like start with empty list go through your array of references grab dentry->d_lock if dentry->d_lockref.count is not zero unlock and continue if dentry->d_flags & DCACHE_SHRINK_LIST ditto, it's not for us to play with if (dentry->d_flags & DCACHE_LRU_LIST) d_lru_del(dentry); d_shrink_add(dentry, &list); unlock on the collection phase and if the list is not empty by the end of that loop shrink_dentry_list(&list); on the disposal.