Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp842662rdh; Thu, 23 Nov 2023 22:05:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+oxheTNhJknoKfSRmBI7pYiBsJ9dbrCqvoe2581JsWh7Tg20hjeINSBmwb2gl46d/fVLJ X-Received: by 2002:a17:90b:3b4a:b0:280:963d:9c5 with SMTP id ot10-20020a17090b3b4a00b00280963d09c5mr2164765pjb.21.1700805917314; Thu, 23 Nov 2023 22:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700805917; cv=none; d=google.com; s=arc-20160816; b=imiuHK58lts7lwuigyZ312L+1Vxrv3RupmgzrSxOxCF4YUfgBOhqFwRLX3duCW3RZj DN3zlOc7YGMgYH+BhLRuVA29mp3yYxnWHKWrk/axGRfWZhEYYWoijTLyuDMU+49ZPZa2 Sue8JUVJCeDWvqPi4MTJqIyBOEDPQmjmmrWMB35bpYeaYDZaTWV4g0TdvV6cksQkMRqp Yei+WDNl8QmbiymSTtApi0j1f0OxWdk1qxknQ4on4bmu/VU5iHWyFa06DUKTVg2JBtDZ oqzgiGIND2STeKkOlX6yEKQs04R7xK1DNC32irLGwCBYAduMgQSMDAHhYqpqJVyWu9GP ar4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rwrYa0ZG4BhKzoZJnT7hD4obIICVmp0PYWpt5r0DLZA=; fh=vDsv/0Rb6aybIi/Xas2DR+uQpFXMLtn4no3J1t38V0s=; b=KtBxSeI2Y6iQ2lQJrxULSkmBxOmwxJG7X8wUCQTP1QPV0raPrWMzYvk+pHM6EZKExP jbexjx9DCS+kRPbJp/ytjmcHjqejRZ/KUmUb/9N9ixZGR3p9iT6pOAB6Mgu/GiwDfrK5 mZtRZIQBKrPibCzWPdQ1pLevM3qKMCd8DAyyycgQFIxKoA2lNigACEE6RKeBhfy2Pnc6 UZKXF0AYHjvwytF8Asfd2D0z49/atr2OyKTeA0CKujfVulOPeh3B40c2XdPazzF/cDYZ hLGuQFK7ECWMw5HImbyUrB8PEEceijqmdKZl19cZJDgJThoWH9YDPVCPLQG3hk7NbnDT hiig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=iTslkxVq; 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 cf2-20020a056a02084200b005c278e32054si2599476pgb.677.2023.11.23.22.05.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 22:05:17 -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=iTslkxVq; 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 25A4881F54E6; Thu, 23 Nov 2023 22:05:15 -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 S232403AbjKXGE5 (ORCPT + 99 others); Fri, 24 Nov 2023 01:04:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231283AbjKXGES (ORCPT ); Fri, 24 Nov 2023 01:04:18 -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 36D3410C9; Thu, 23 Nov 2023 22:04:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=rwrYa0ZG4BhKzoZJnT7hD4obIICVmp0PYWpt5r0DLZA=; b=iTslkxVqcE3fNcRd/dfxoL6H8N RN4tz9z1Zfv4kEhhHiNJprCk9+cVZRuIyyFg+8VO9hWYeRVcgdt88EAwtvStc7Rb2aPfVDWL3FDLq np8N/Qbd2cVqQuikxDzPb2CBL0eCYqi/llJfQkwKweEN46hFjsmKGBVDvuYJc0J7qryZrSLjSeZgf 3ZIFOykh9eZfB1wvxa4CdQCGratzJa16QpbrplcDQ1OW2qzgY7tiOKXTesvdEieeGrHRFK9BhlYKi SVxlhAUXCftobhULyxe/r9SrspnXscdpdQI+c6a3N3iqtTssP/+DCCYLKMNo9QCqJRAsr2L0nGa0h B7hxuKwQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1r6PId-002PuH-2S; Fri, 24 Nov 2023 06:04:23 +0000 From: Al Viro To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Christian Brauner , linux-kernel@vger.kernel.org Subject: [PATCH v3 09/21] __dput_to_list(): do decrement of refcount in the callers Date: Fri, 24 Nov 2023 06:04:10 +0000 Message-Id: <20231124060422.576198-9-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231124060422.576198-1-viro@zeniv.linux.org.uk> References: <20231124060200.GR38156@ZenIV> <20231124060422.576198-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22:05:15 -0800 (PST) ... and rename it to to_shrink_list(), seeing that it no longer does dropping any references Reviewed-by: Christian Brauner Signed-off-by: Al Viro --- fs/dcache.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/dcache.c b/fs/dcache.c index a00e9ba22480..0718b3895c12 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -902,16 +902,13 @@ void dput(struct dentry *dentry) } EXPORT_SYMBOL(dput); -static void __dput_to_list(struct dentry *dentry, struct list_head *list) +static void to_shrink_list(struct dentry *dentry, struct list_head *list) __must_hold(&dentry->d_lock) { - if (dentry->d_flags & DCACHE_SHRINK_LIST) { - /* let the owner of the list it's on deal with it */ - --dentry->d_lockref.count; - } else { + if (!(dentry->d_flags & DCACHE_SHRINK_LIST)) { if (dentry->d_flags & DCACHE_LRU_LIST) d_lru_del(dentry); - if (!--dentry->d_lockref.count) + if (!dentry->d_lockref.count) d_shrink_add(dentry, list); } } @@ -925,8 +922,10 @@ void dput_to_list(struct dentry *dentry, struct list_head *list) } rcu_read_unlock(); dentry->d_lockref.count = 1; - if (!retain_dentry(dentry)) - __dput_to_list(dentry, list); + if (!retain_dentry(dentry)) { + --dentry->d_lockref.count; + to_shrink_list(dentry, list); + } spin_unlock(&dentry->d_lock); } @@ -1165,8 +1164,10 @@ static bool shrink_lock_dentry(struct dentry *dentry) static inline void shrink_kill(struct dentry *victim, struct list_head *list) { struct dentry *parent = victim->d_parent; - if (parent != victim) - __dput_to_list(parent, list); + if (parent != victim) { + --parent->d_lockref.count; + to_shrink_list(parent, list); + } __dentry_kill(victim); } -- 2.39.2