Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp914981ybb; Wed, 1 Apr 2020 12:00:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs0D+yxOBxRf4L+4EQBRP8s90d25g6m6rcjsRV5KBxGRwXRkZJiPSEdydXhHNmJhDyOK8sq X-Received: by 2002:a9d:6c19:: with SMTP id f25mr18560818otq.371.1585767600043; Wed, 01 Apr 2020 12:00:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585767600; cv=none; d=google.com; s=arc-20160816; b=tPZiC015iEUi3MqMxmzTLqzyYseJkLyTyhdHnL+m18mSceloubgp1OEdmGHtClYAKS 6taHxM0dFMS97j+7WYDkStrxS4tvwzK8wZbWB4ERrIz4RzmTjp+ly4H0fnKzXcdE2ilE cnDM7siJLpAtgC//KUQWBXSroJthY+kAVsnHY4XiGMaf+44OUjPKFGsT6tsiEm7a7Pbe qh+3epfUN/EIJlXeUb45vJIpTQICq3lLr6gVnvaUZj9jJ8b2pDXTLeVEb9Q4TvqoYzyL q3yxYDxZKjoZYMrBD+uK4LkhqUHrR4EPDaBCQezMtGCnrH5kbukkDV8FmEerwxkfYA1R yTug== 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:to:from :dkim-signature; bh=TQ98hr4usKCMvso0zMU++ieTmlDEvB9Ux2k6h70ToWc=; b=HZe8K7xlwUfPCgR1GfwwyDErZI8MfyxNi+o0Li+7pSvo+yFynqJSDaveovuUw5Bx7t CSi4u4ZEGFAn1cZFxRWmnB0knVKop+N5OQtV3kjztxheoQlx3bKc1fkTzRnoGObKeMnc Y7WXTAhacXiU8nkgs89JOfzCAlaCM9bmivvwuIkPpQyw7wLcZhY1RgU5Lj8y91Ec387o jnqhZz3tr7tL3uf7Sa6KlbA65o90wuaM9tnSHSWCLQyDZtm174QTL5ZOMRXt6TZufecv 3AbeRJ4712h2uLhG/lEUPin8xv7uigttXrbWstr7Hdnhfxxa3oY2xV31mAh71VyaqXBV 9VtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E89UrnRa; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y1si1204142otq.87.2020.04.01.11.59.48; Wed, 01 Apr 2020 12:00:00 -0700 (PDT) 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=@kernel.org header.s=default header.b=E89UrnRa; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732211AbgDAS7D (ORCPT + 99 others); Wed, 1 Apr 2020 14:59:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:36676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732214AbgDAS7D (ORCPT ); Wed, 1 Apr 2020 14:59:03 -0400 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8C1D3206F5 for ; Wed, 1 Apr 2020 18:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585767542; bh=VH3naXrZJNmMM76JYbMGM3fauW+ZNrMH7wpXWz6OOaE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=E89UrnRaO4Sxi4Ltid+X6g5It7HMKhA3MAI/v2gWSCsLzy2ZsI8HyVZFhiaFvEuxn m7mnt9lWWJPAb2cx6zAvS4lXovohFSLgztz+mCci7Q+JxYnkfrFmIphFxqPSowuU3Y Quh79sVInOpEHu0/6RKMhIrT9HR9Q0PHWOr9Vr2Y= From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH 05/10] NFS: Fix memory leaks in nfs_pageio_stop_mirroring() Date: Wed, 1 Apr 2020 14:56:47 -0400 Message-Id: <20200401185652.1904777-6-trondmy@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200401185652.1904777-5-trondmy@kernel.org> References: <20200401185652.1904777-1-trondmy@kernel.org> <20200401185652.1904777-2-trondmy@kernel.org> <20200401185652.1904777-3-trondmy@kernel.org> <20200401185652.1904777-4-trondmy@kernel.org> <20200401185652.1904777-5-trondmy@kernel.org> 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 From: Trond Myklebust If we just set the mirror count to 1 without first clearing out the mirrors, we can leak queued up requests. Signed-off-by: Trond Myklebust --- fs/nfs/pagelist.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 99eb839c5778..1fd4862217e0 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c @@ -900,15 +900,6 @@ static void nfs_pageio_setup_mirroring(struct nfs_pageio_descriptor *pgio, pgio->pg_mirror_count = mirror_count; } -/* - * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) - */ -void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) -{ - pgio->pg_mirror_count = 1; - pgio->pg_mirror_idx = 0; -} - static void nfs_pageio_cleanup_mirroring(struct nfs_pageio_descriptor *pgio) { pgio->pg_mirror_count = 1; @@ -1334,6 +1325,14 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index) } } +/* + * nfs_pageio_stop_mirroring - stop using mirroring (set mirror count to 1) + */ +void nfs_pageio_stop_mirroring(struct nfs_pageio_descriptor *pgio) +{ + nfs_pageio_complete(pgio); +} + int __init nfs_init_nfspagecache(void) { nfs_page_cachep = kmem_cache_create("nfs_page", -- 2.25.1