Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21745116ybl; Mon, 6 Jan 2020 10:20:45 -0800 (PST) X-Google-Smtp-Source: APXvYqyqRXY1sQCXkjCZWWtVQ3xSz7j5iVaBm99w/l0WrK1M/nLyyt+x2LGHVMfsj0fnzjTLTfC/ X-Received: by 2002:a9d:6acd:: with SMTP id m13mr110919489otq.313.1578334845434; Mon, 06 Jan 2020 10:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578334845; cv=none; d=google.com; s=arc-20160816; b=AGsUXYFMCCwq3xDZO3gX67+guhojSVOflyeXW/Vkg+r4a5PksTSz4/Eyb3xejy+TL9 lIhDillufuVqW0I4BuiPsAUacBNJrpeuQL9AfRoEv8sN6SxzCg3nZA25DgMfnN6Unpaa Fs3aHsGtAK0H86KRJxKohEjDSbXB8X7j3HBd4HoNUEzHy6LhUKGqJtmshPJY/VxWTTed 5/zZQ5AVrAaXPCNAPNv1xeTvz1N/g7M0hO7o7h3xlX0p/sLSUJ7f0+WODGL8e84duUsQ 0Ydur81eS/EW0iJMZxZjWODTzNB83Cs8mz/jybHYQsg7q3KNyu7h2mq8LU5vEcepXywp nwgQ== 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=rtsdhCrWJX5DzFNesThGe18gpecWEgRIZqACkkfv9FA=; b=npbfBwCsxQ2oJBlYxzEbuG6MmYo8ljUdeFDMKU/L8sruXoBkBHg+CBBbKmm1jecRp/ r6XfPdGJqDgazYJ/neTjF1cB1vDRpm1L7NRPKwjVb8kJLspiLcvcKFXU91xoArnrxhss 6MT8XiPwag5DidQ9KWSY/S16+uHzGCy/Rzw0CJzsnIAI2r/smDuDYCzE9flsyMQTzTPb PEo8+A+33UYmyjHijSUXOG6sI10swUW5mHumNJLIB7+ubj7Fv7kJ6yd2LCtmTrQVb+GD niaHYj7VMdCY/irwlNdDC7Pyu8fVEzlAXbZPQtrYVIuW+WAl7kuOOobz/90N2HHT8lpO hfUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="hLMKcID/"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si24104400oic.168.2020.01.06.10.20.27; Mon, 06 Jan 2020 10:20:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="hLMKcID/"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726695AbgAFSU0 (ORCPT + 99 others); Mon, 6 Jan 2020 13:20:26 -0500 Received: from mail-yb1-f193.google.com ([209.85.219.193]:47075 "EHLO mail-yb1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726569AbgAFSUZ (ORCPT ); Mon, 6 Jan 2020 13:20:25 -0500 Received: by mail-yb1-f193.google.com with SMTP id k128so11451628ybc.13 for ; Mon, 06 Jan 2020 10:20:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rtsdhCrWJX5DzFNesThGe18gpecWEgRIZqACkkfv9FA=; b=hLMKcID/Xevb2W4Cd7mfa+CTclzY755gzF/d8BmPejubC682KWHkY07DSzTaD7Z2PL 972kBiiTSf6HPED4E7ULjQnix9p2QOJKFV0NQKV+7NJZAsGrhbQgWOu6hXNsiU1BBUCN /yHgE+lmo8G27C8hRtqN9ZkFL/QMfP7vd9mjfw5SaoS1dGVOAwwjR5lwOwWfg+BJwHtt s2lrNlq5HtLlKQt6LuRcZKdQkikjpSQ4Dx72CDBN6AJ9SaeBc4akf8jDcZJZJmr0TiT7 OxmX6mAmZr3cJXlA7w7uJPXZZfYfzH86i26BOqUHGeAID+wyoLFGOK1H4roIblpSU+4F K/ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rtsdhCrWJX5DzFNesThGe18gpecWEgRIZqACkkfv9FA=; b=Bk7eD9frxIXPrKWq5Y+p7EvkU+syzIOKTkGxUPzemyX9EUffTtwxaPMVliweY7T4fd 9HDJ5XGf9E+ltVNY1EnsT+9MaDJwmBK4SpnXvOUnvyXzzeMM3GJ2u+7C6fL5IdjogbFo dGVQWGgZgupe5bE6gPYoZFTun5tgQhDNz0IbFHE8NLiRXGmb2C01SY++U2BdhHi6qp7k 95lmZuF6F8deYEIjI6dV4XKLRGiTTNjL1t8+27ZmT1HMI9cVDBEk6byHaQuN8UtAfUku ovefYTSFOhPTKhsinKO/UjMk7Q6ECCCjYR1ZzSdUPQ6x2FFY7NR5jUN9r3tsnuxbF4gW Wr6g== X-Gm-Message-State: APjAAAXUfFoOnZprY8/bkZVzRBh055ecLDXh6wBix7AUJEtvInRCo6ud hNDiT1QQdHvrtT1e2yQWjV+qGr3lew== X-Received: by 2002:a25:743:: with SMTP id 64mr77285395ybh.178.1578334824728; Mon, 06 Jan 2020 10:20:24 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id r31sm24800524ywa.82.2020.01.06.10.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 10:20:24 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH RESEND 2/6] nfsd: cleanup nfsd_file_lru_dispose() Date: Mon, 6 Jan 2020 13:18:04 -0500 Message-Id: <20200106181808.562969-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106181808.562969-2-trond.myklebust@hammerspace.com> References: <20200106181808.562969-1-trond.myklebust@hammerspace.com> <20200106181808.562969-2-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Trond Myklebust --- fs/nfsd/filecache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 0a3e5c2aac4b..c048e3071db7 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -256,8 +256,6 @@ nfsd_file_do_unhash(struct nfsd_file *nf) nfsd_reset_boot_verifier(net_generic(nf->nf_net, nfsd_net_id)); --nfsd_file_hashtbl[nf->nf_hashval].nfb_count; hlist_del_rcu(&nf->nf_node); - if (!list_empty(&nf->nf_lru)) - list_lru_del(&nfsd_file_lru, &nf->nf_lru); atomic_long_dec(&nfsd_filecache_count); } @@ -266,6 +264,8 @@ nfsd_file_unhash(struct nfsd_file *nf) { if (test_and_clear_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { nfsd_file_do_unhash(nf); + if (!list_empty(&nf->nf_lru)) + list_lru_del(&nfsd_file_lru, &nf->nf_lru); return true; } return false; @@ -402,15 +402,14 @@ nfsd_file_lru_cb(struct list_head *item, struct list_lru_one *lru, static void nfsd_file_lru_dispose(struct list_head *head) { - while(!list_empty(head)) { - struct nfsd_file *nf = list_first_entry(head, - struct nfsd_file, nf_lru); - list_del_init(&nf->nf_lru); + struct nfsd_file *nf; + + list_for_each_entry(nf, head, nf_lru) { spin_lock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); nfsd_file_do_unhash(nf); spin_unlock(&nfsd_file_hashtbl[nf->nf_hashval].nfb_lock); - nfsd_file_put_noref(nf); } + nfsd_file_dispose_list(head); } static unsigned long -- 2.24.1