Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp64852pxu; Wed, 6 Jan 2021 21:34:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxglDzlgjcV0C6aRHKVRfs8yvFbOWuOnaw/0cQRm02eebqG3dm6sF3zyC/0OvIiDt+Ca9YF X-Received: by 2002:a05:6402:697:: with SMTP id f23mr409013edy.318.1609997667112; Wed, 06 Jan 2021 21:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609997667; cv=none; d=google.com; s=arc-20160816; b=REwS/HxqDanzg3CFH4qfwKu/ZtLiL+BFh0w7zHur5fS6nnkmQUQkC/7SjtSyMBIh+f 5uaqAFF2eiBaAu22wweZC9zWvQJnUxZQ28WN2+YsE1XgMI5EX2mTpWIHwf/ejQpCEZOw XCt0+Ox9fZRS64q5ueovhIrH4wPcJFs/sc/ILtzlBgRuBs+SpWoX1QgzVG1sMAKUo/d0 k9B4ot+AhzyNWwd8Uvi0gYMve50vWwFRZ4IYD5XsPfbqYhXpfplc/enkdQt8nQnCohA9 KtIzYmTv3L2wJxlvWWv6v+N4F9/AvKjzLkhbA9hv0S8si2FWd570WFXaz2ozoM9KGsye lbUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=hXpFVUmKTrppphu0PAG8/xCpqZRwx7yZwJdQKz7eSJQ=; b=ZyjFP6+nB9Jba3KbqD/U7Soer9So2Fct3elmqsGcydV+ICgnEKn2U5E30SbjQj1YlH XfrZUF4kN6ryRDljJHJLA6F4JUShwWWrlKg/sH5SMM8bbCytz3XS6XenxRM1onfiqEKN Ym80YzYwziW0EPJKcYKXAGNIHdo2pS9evTaBzXZ5LIpG9y+Qjwq0ZzAq1w5BLx0sQLyU pqMigMYQiOn6eDO8XL6QriG1J+cIPrKHRBloDEQfvJN8uvRHA9SJYYQzW2UFbmHf4iSw 8ia/9thsbL+ASGiv9dEVacyv28roCItzDWpsUjRzNlFQ41EX2+YfDaIF0cyoM5Thujy2 PFYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CLUUGsl2; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt22si1662630ejb.107.2021.01.06.21.34.07; Wed, 06 Jan 2021 21:34:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CLUUGsl2; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725862AbhAGFcO (ORCPT + 99 others); Thu, 7 Jan 2021 00:32:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:47214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725792AbhAGFcN (ORCPT ); Thu, 7 Jan 2021 00:32:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 322BD22E03 for ; Thu, 7 Jan 2021 05:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1609997493; bh=/R1M0T6Kd3g2Y/TZcD2GM9uO8zV8lOJ1cWbQeRN6kMo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=CLUUGsl2eOHix6rDjVkBmpMfrFL3sFWBD1+juq286DbXMh6EFY4rrgnUOvMKk2PkU +Kv7bFFXhpMlUdLn6NMoEFRD1h9CiggyhC9/tsDd/iz1he+MmBrlRlNjUi/6MM2qvX VynQPudD/cP1wlLCS/qGxWPgV3w3kOkU2YIhT2wSF9rc6Aud2Dg2Hgo7TG5olHaaJJ qXNNDdD59Mj2j9SauUYx6flZgHBw2BA6C2XgFwGq7Qk4OupttMhu0mZV6zC4COId9v LwGVXM4A8woBz8uv4w6eBxAT1wO9JNdLPQW2T9TdGXcHidiKHroYWEmKlnNXT6yXv7 JHqODE9BXC2Tg== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v2 5/7] NFS/pNFS: Don't call pnfs_free_bucket_lseg() before removing the request Date: Thu, 7 Jan 2021 00:31:28 -0500 Message-Id: <20210107053130.20341-5-trondmy@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107053130.20341-4-trondmy@kernel.org> References: <20210107053130.20341-1-trondmy@kernel.org> <20210107053130.20341-2-trondmy@kernel.org> <20210107053130.20341-3-trondmy@kernel.org> <20210107053130.20341-4-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust In pnfs_generic_clear_request_commit(), we try calling pnfs_free_bucket_lseg() before we remove the request from the DS bucket. That will always fail, since the point is to test for whether or not that bucket is empty. Fixes: c84bea59449a ("NFS/pNFS: Simplify bucket layout segment reference counting") Signed-off-by: Trond Myklebust --- fs/nfs/pnfs_nfs.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/fs/nfs/pnfs_nfs.c b/fs/nfs/pnfs_nfs.c index 2efcfdd348a1..df20bbe8d15e 100644 --- a/fs/nfs/pnfs_nfs.c +++ b/fs/nfs/pnfs_nfs.c @@ -78,22 +78,18 @@ void pnfs_generic_clear_request_commit(struct nfs_page *req, struct nfs_commit_info *cinfo) { - struct pnfs_layout_segment *freeme = NULL; + struct pnfs_commit_bucket *bucket = NULL; if (!test_and_clear_bit(PG_COMMIT_TO_DS, &req->wb_flags)) goto out; cinfo->ds->nwritten--; - if (list_is_singular(&req->wb_list)) { - struct pnfs_commit_bucket *bucket; - + if (list_is_singular(&req->wb_list)) bucket = list_first_entry(&req->wb_list, - struct pnfs_commit_bucket, - written); - freeme = pnfs_free_bucket_lseg(bucket); - } + struct pnfs_commit_bucket, written); out: nfs_request_remove_commit_list(req, cinfo); - pnfs_put_lseg(freeme); + if (bucket) + pnfs_put_lseg(pnfs_free_bucket_lseg(bucket)); } EXPORT_SYMBOL_GPL(pnfs_generic_clear_request_commit); -- 2.29.2