From patchwork Tue Jan 15 02:37:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ycnian@gmail.com X-Patchwork-Id: 1974361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8C9B43FE33 for ; Tue, 15 Jan 2013 02:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756133Ab3AOCrg (ORCPT ); Mon, 14 Jan 2013 21:47:36 -0500 Received: from mail-pb0-f41.google.com ([209.85.160.41]:52063 "EHLO mail-pb0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673Ab3AOCrg (ORCPT ); Mon, 14 Jan 2013 21:47:36 -0500 Received: by mail-pb0-f41.google.com with SMTP id xa7so2566161pbc.28 for ; Mon, 14 Jan 2013 18:47:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=PRa/wBaYy8TRaHwr+seVkYJkSH/yozm/XUrGUwnznic=; b=UdJf6oOcVUnXXxOC1V5qdYfOcOWIOf+X2SsaACjAAfEpYjPvMyhCaxrfTHZohwTWwL 2ztAbRg6n0iAZ0DiP3/sI+WrNpLp7Af+IJfgoEoNcsw38uSna1IVzBgAca22rJOiS7UP dO8T2MTZo9Y/T54AB0rZR7dCzwOdxKT9bgCVN1Bz5xL+n7YIRWHRZl9JDNKNyUZ+F1BE I2mEUrAFYOF9MxRxHjbCYD3owxSoLLdYibhA3gsYfx7ZQbQ3LcfVZWLkDk8KMmdXYb0X 95Ot8uTbiI7wF/sbJ4OvY6pyMV/wD92b/HYYXlTBouVDtCO/fWKIC6FGcvno2wQClgXq upag== X-Received: by 10.68.192.97 with SMTP id hf1mr259379222pbc.106.1358218055506; Mon, 14 Jan 2013 18:47:35 -0800 (PST) Received: from localhost ([159.226.5.131]) by mx.google.com with ESMTPS id a9sm9854915pav.24.2013.01.14.18.47.33 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Mon, 14 Jan 2013 18:47:34 -0800 (PST) From: ycnian@gmail.com To: bhalevy@tonian.com Cc: linux-nfs@vger.kernel.org, Yanchuan Nian Subject: [PATCH] pnfsd: Update the reference of nfs4_layout_state properly Date: Tue, 15 Jan 2013 10:37:51 +0800 Message-Id: <1358217471-18458-1-git-send-email-ycnian@gmail.com> X-Mailer: git-send-email 1.7.4.4 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Yanchuan Nian The reference of nfs4_layout_state is set to 1 when creating. it isn't necessary to increase the reference again in nfs4_process_layout_stateid(), otherwise it will lead to a memory leak. Signed-off-by: Yanchuan Nian --- fs/nfsd/nfs4pnfsd.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/nfs4pnfsd.c b/fs/nfsd/nfs4pnfsd.c index 2211b50..dd7856c 100644 --- a/fs/nfsd/nfs4pnfsd.c +++ b/fs/nfsd/nfs4pnfsd.c @@ -248,10 +248,10 @@ nfs4_process_layout_stateid(struct nfs4_client *clp, struct nfs4_file *fp, status = nfserr_bad_stateid; goto out; } + get_layout_state(ls); } status = 0; - get_layout_state(ls); *lsp = ls; dprintk("%s: layout stateid=" STATEID_FMT " ref=%d\n", __func__, STATEID_VAL(&ls->ls_stid.sc_stateid), atomic_read(&ls->ls_ref.refcount));