Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5848385ybl; Tue, 10 Dec 2019 12:30:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxTOwfTGauCrdrJqVPHcmCo7zkIMM58mz0broC3icxSqqU/C9eI5WfceVN1PhMa3IAm0pXP X-Received: by 2002:a05:6830:2154:: with SMTP id r20mr10577705otd.66.1576009814543; Tue, 10 Dec 2019 12:30:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576009814; cv=none; d=google.com; s=arc-20160816; b=R650vd4dcJUxqHlMUtUAwMF3Xjvur8jG5aP2ggOUd8R+nPzsQxecuvkBO7h0ZJ3vHi hkzLvjEbnsb4KJB7EOlNTBe/kKorfHxg1r6ecMp6cZXfhQ3G05QkONLlSPJ0yCxT3IxV ay5SgT3CZ5YK1qHO2NYXnNPGYy/irf4HS8o/mwdUU9grg4jmX3beKu3ZwGGmco2DdS8B hXvcQVl3yfjyqznqZMSpG+4HjcaArUWIUAFO01kwnBu4/LVd8LvZZb2VSs5fvaoj+gLC yhN+PdHB5zwAKn8nlJvvBg/pzRJFk+JAVq/JLSg2Y/QCblpiEgG5tIeXF7eiy/CHVqZh Nbrw== 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=N/nhr9SYe3Lf1NBGV+k83w8+Y7/b7c+eVtxtCi3KLLE=; b=wjMkTU0nY0ukpp03bJJag+evmGYP6uWsYfsn5MptwrhGBU4jEP+3sMeiCAr4hTSFd4 5eer+4D1/c3L5LhxBWWSu3qOhN02GKLEb1HKWh4+qKSUcF5lYpvhJgieT94hFEYaQjv7 Np2jdeR08JkMMwesriD65/aDWa4V3eHh+hMl+aTvM42zjZ2vp08ZCsld9Rd3uLasp76s dYRuZXFA/7iDh6XAAX6FNQqMuzA6NyeZekqudpzSYw6heywb48X+tIHVze9F7w9a2gXq u+Vh7bFty4LiMJ9cr6C2ai9U6QtQ0zIUC+wttFmTXDeYRSJIryM/d94emJFEf3QCydqW d46w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CcQ+xP2D; 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 l3si2640190otb.319.2019.12.10.12.30.03; Tue, 10 Dec 2019 12:30:14 -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=CcQ+xP2D; 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 S1725999AbfLJU3s (ORCPT + 99 others); Tue, 10 Dec 2019 15:29:48 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:35434 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726816AbfLJU3s (ORCPT ); Tue, 10 Dec 2019 15:29:48 -0500 Received: by mail-yw1-f68.google.com with SMTP id i190so7855513ywc.2 for ; Tue, 10 Dec 2019 12:29:47 -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=N/nhr9SYe3Lf1NBGV+k83w8+Y7/b7c+eVtxtCi3KLLE=; b=CcQ+xP2Duo20BVtLTsVYwzYBHY1rT2iGmZ+MzpvThV8XLGTQvuaplAf9G8XoaZm6NU foXvX60VsQGuBjJDToSjEsEFu6neG2LhzKmy8OIVEQxtRez8NFDBS8iYNMNHvQefQJIE izU9UsbNlQeHA6CCMB6sisQORAoLW2QqOhz6/qJAVgIqso90k1yP9w3w5MjGpTFIMVLs Mj9H6iDFktxlGzs5nHgGwy9MVQdABhJ5kJkj3pzKz1qajNIH6IftIp0/gaqtmIrM3UES 3/vNkHIqNk12Vx7umyHWSGBIM2QbGK4Eg9gtLR/ywyUIf+1EgpDKVp9y7iP7xCSYZsV3 8/Tw== 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=N/nhr9SYe3Lf1NBGV+k83w8+Y7/b7c+eVtxtCi3KLLE=; b=lLui7wB8Nf14qJDxRDniKjRWSDTZyfU+tIC8X0u3rCfx7EsQv+6T6xSb2o1E4M0mS6 6W5Qdken7+kfUl53UbL9Seuot4T2SO/kXtugZ+zYvjEiVY7yhsJ4gGKjD5f1P/IVURJy oN4dCWHd+wH4oWRupMoPshzbor5CIRGs+7k82e/CFT7BitvFpjaU0hnducsnKS4xbH1x 1g6qVaxXj6J9sSxJxD0C3Eprea/x/cZ7LQCQp4GsXeBzrIQuxK5548pMyx4eZ8ARkbSY vQOjQtFsZPvHi181i0Id9sofaMbwq85qLtrBNaVgbHad4Rxl9kkO3LhRa3TtUqTHPZF1 H6aQ== X-Gm-Message-State: APjAAAXRRua9Lg08YUfvEybjGNWROit6VfrcttDN9XTog4up3EIpXABB Z6WnOOWxAaPF3Gl5PyJD7sVnGiY= X-Received: by 2002:a0d:cd44:: with SMTP id p65mr27126217ywd.118.1576009786856; Tue, 10 Dec 2019 12:29:46 -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 x84sm1947508ywg.47.2019.12.10.12.29.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 12:29:46 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J. Bruce Fields" Cc: Chuck Lever , linux-nfs@vger.kernel.org Subject: [PATCH 2/6] nfsd: cleanup nfsd_file_lru_dispose() Date: Tue, 10 Dec 2019 15:27:31 -0500 Message-Id: <20191210202735.304477-3-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191210202735.304477-2-trond.myklebust@hammerspace.com> References: <20191210202735.304477-1-trond.myklebust@hammerspace.com> <20191210202735.304477-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.23.0