From patchwork Sun Sep 20 15:03:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 7226081 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1BFE0BEEC1 for ; Sun, 20 Sep 2015 15:03:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3EE12208ED for ; Sun, 20 Sep 2015 15:03:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 512CE2074A for ; Sun, 20 Sep 2015 15:03:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752650AbbITPDo (ORCPT ); Sun, 20 Sep 2015 11:03:44 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:32998 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbbITPDn (ORCPT ); Sun, 20 Sep 2015 11:03:43 -0400 Received: by pacex6 with SMTP id ex6so93273349pac.0 for ; Sun, 20 Sep 2015 08:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=Hxdm8ONgoa4mtxe5/ESa6dr09SNux62PJIs/EER5tjU=; b=okgqVSo9nUGVyXROA/d5RSlRj6PLCTM1QQyGmn3XOmoysoPIt+oE+nhsC7D6VOn8rz AoKBAGOuecMUX4NcbhwFtiXodZFPl0mUeU3ckyV7ycFcV+6Hk3iN5cxilFxILAXhokI0 bz4ngc4xS595zV/7zLNv9Rua8tHKwiePIZ/W/+j7TDsrrClKi/12W4e5wjmeYYLh8mSZ KjL2ae5goSLgoNdtDbMtReqT4D01xVvb95m4G/FMfCUqKXFhVekUV2MAt+RcnDk8GKRD ksBA1ONPX52p82jyRnWc3FONE9x3Hfb0dehAGLOt8tJUBHi2mxIInMMgPY7AEQBBK4PL K8PA== X-Received: by 10.69.0.132 with SMTP id ay4mr18551257pbd.87.1442761423082; Sun, 20 Sep 2015 08:03:43 -0700 (PDT) Received: from [192.168.99.2] ([104.143.41.79]) by smtp.googlemail.com with ESMTPSA id qy5sm19425685pbb.16.2015.09.20.08.03.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Sep 2015 08:03:41 -0700 (PDT) To: Trond Myklebust Cc: "linux-nfs@vger.kernel.org" , Weston Andros Adamson , kinglongmee@gmail.com From: Kinglong Mee Subject: [PATCH 1/2] NFS: Do cleanup before resetting pageio read/write to mds Message-ID: <55FECAC0.6040800@gmail.com> Date: Sun, 20 Sep 2015 23:03:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is a reference leak of layout segment after resetting pageio read/write to mds. Signed-off-by: Kinglong Mee --- fs/nfs/read.c | 3 +++ fs/nfs/write.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index ae0ff7a..01b8cc8 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -72,6 +72,9 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio) { struct nfs_pgio_mirror *mirror; + if (pgio->pg_ops && pgio->pg_ops->pg_cleanup) + pgio->pg_ops->pg_cleanup(pgio); + pgio->pg_ops = &nfs_pgio_rw_ops; /* read path should never have more than one mirror */ diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 388f480..72624dc 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1351,6 +1351,9 @@ void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio) { struct nfs_pgio_mirror *mirror; + if (pgio->pg_ops && pgio->pg_ops->pg_cleanup) + pgio->pg_ops->pg_cleanup(pgio); + pgio->pg_ops = &nfs_pgio_rw_ops; nfs_pageio_stop_mirroring(pgio);