Received: by 10.192.165.156 with SMTP id m28csp2281215imm; Sat, 14 Apr 2018 19:44:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+knj1BCwwB+L61axG6ioXkvxFbVUb4ykxAcfeI8nCNfI5vboSzgLaS9XYf/5a+V9VHRVl6 X-Received: by 2002:a17:902:5609:: with SMTP id h9-v6mr10711243pli.121.1523760248843; Sat, 14 Apr 2018 19:44:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523760248; cv=none; d=google.com; s=arc-20160816; b=lNwV7hbYhwbsEuph2WclEaar76SJwTZO2A6/qQMAldSJLO/cm69nwyDm/vWrToQU0D o2oNs8bVxzUitkAm1hD4ZGH4odcINtk1opo+lBm0LIPwzf6LS0erTtEMAaq8YE0Q7KtS VkwTC25kI/f2Zwj4Hm0NwzlIOMI2Vo2Ganc4PPBcwyWYtEKVqtK4Os4Y2XpRvOiY7538 B2nj7I1mrjDLdaPMIG6S0Nkoed36jzGR2lywlwwJCX2F0Mz1Dw1dlyq4qG5AdDWFn0QK DEsRafJPMe2n08S90Esuo4j8HSOQ5wfTBPdTIWwMjVQlgSi95zEmG0l1PRIy4BZWqdvg hwHQ== 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:arc-authentication-results; bh=dbkzya1Ejg+4btFS5n5j/exDJeYD/4oRNRzIU67j45M=; b=rcrNdFnQeeh4638bDbOAORT0UjUIVeAR5pYJLMC9RFin6JRWKbIXg1Oa4uQ9O9+T/S 5/+deSVOSLugYAxOPbdNNYUKYf+Pix6fg0zsL586asFYH01BrTz2Ed2gG97lPNu2UIyY CDD1lMSlVmqHIiyQ/dfl4j/Pn7XmE8C1I/aDa2coXqS/ZT3HvKFXZ+geon8hGCRoTRNr ewyaTtuvVjd7Ty4555iaNY7dtt21EZ/jHph1JZrV9s0ItyexUwPOq9negF+c0vztHWUt LpG9CrnPqM2Cx3WeCy7TukwsKeCC87jlFQKaCMFGRvmzy+gWA52irWJLaF51+k+A42sa pUwg== 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 y7-v6si9084918plh.583.2018.04.14.19.43.23; Sat, 14 Apr 2018 19:44:08 -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 S1752351AbeDOCkZ (ORCPT + 99 others); Sat, 14 Apr 2018 22:40:25 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:40590 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752163AbeDOCkX (ORCPT ); Sat, 14 Apr 2018 22:40:23 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1f7XZw-0004Iu-1y; Sun, 15 Apr 2018 02:39:52 +0000 Date: Sun, 15 Apr 2018 03:39:44 +0100 From: Al Viro To: Linus Torvalds Cc: Nikolay Borisov , Andrew Morton , Khazhismel Kumykov , linux-fsdevel , Linux Kernel Mailing List , David Rientjes , Goldwyn Rodrigues , Jeff Mahoney , Davidlohr Bueso Subject: Re: [PATCH] fs/dcache.c: re-add cond_resched() in shrink_dcache_parent() Message-ID: <20180415023939.GY30522@ZenIV.linux.org.uk> References: <20180413181350.88831-1-khazhy@google.com> <20180413202823.204377-1-khazhy@google.com> <20180413141430.2788e2562e3e24bd273fe78b@linux-foundation.org> <3362fb2d-85ff-86af-399f-698c986e46cc@suse.com> <20180414080206.GV30522@ZenIV.linux.org.uk> <20180414205846.GW30522@ZenIV.linux.org.uk> <20180415005056.GX30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180415005056.GX30522@ZenIV.linux.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 15, 2018 at 01:51:07AM +0100, Al Viro wrote: > On Sat, Apr 14, 2018 at 02:47:21PM -0700, Linus Torvalds wrote: > > On Sat, Apr 14, 2018 at 1:58 PM, Al Viro wrote: > > > > > > That breaks d_invalidate(), unfortunately. Look at the termination > > > conditions in the loop there... > > > > Ugh. I was going to say "but that doesn't even use select_collect()", > > but yeah, detach_and_collect() calls it. > > > > It would be easy enough to just change the > > > > if (!list_empty(&data.select.dispose)) > > > > there to > > > > if (!list_empty(&data.select.found)) > > > > too. > > You would have to do the same in check_and_drop() as well, > and that brings back d_invalidate()/d_invalidate() livelock > we used to have. See 81be24d263db... > > I'm trying to put something together, but the damn thing is > full of potential livelocks, unfortunately ;-/ Will send > a followup once I have something resembling a sane solution... I really wonder if we should just do the following in d_invalidate(): * grab ->d_lock on victim, check if it's unhashed, unlock and bugger off if it is. Otherwise, unhash and unlock. From that point on any d_set_mounted() in the subtree will fail. * shrink_dcache_parent() to reduce the subtree size. * go through the (hopefully shrunk) subtree, picking mountpoints. detach_mounts() for each of them. * shrink_dcache_parent() if any points had been encountered, to kick the now-unpinned stuff. As a side benefit, we could probably be gentler on rename_lock in d_set_mounted() after that change...