From patchwork Mon Mar 11 00:46:14 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: 2246141 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 2729440E2C for ; Mon, 11 Mar 2013 00:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753589Ab3CKA6S (ORCPT ); Sun, 10 Mar 2013 20:58:18 -0400 Received: from mail-da0-f41.google.com ([209.85.210.41]:43742 "EHLO mail-da0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753317Ab3CKA6R (ORCPT ); Sun, 10 Mar 2013 20:58:17 -0400 Received: by mail-da0-f41.google.com with SMTP id j17so642105dan.0 for ; Sun, 10 Mar 2013 17:58:16 -0700 (PDT) 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=mm9o4qlHHbBakEe//YDfweo+/ittNHF/+BYFKJJPU5s=; b=CcVddZtF+kbYvN9+IGoIp3Tk6KLHH19LaDfoHcJii2CUcA5qKilsC7sONvS4qJHSC1 ft6NBvEPS6ZgjVKDic/KaUTF0FlCR4k3OZ+QqsGnG5FP7Fl2fd3anlQhZAabm/2TGJKT H+4jE+2sHrwncL4ogfBdRCl4mYtg995ZNczWEkEPIqY2EI2nDtEbmAEUjgwTJ2IKW8q2 KmwFtbnFIbNFCj49GDcBg5kH+/a3iVO7TXoiw9fgsFNofHIXkMP0pRzbkO1Ay71+LGZ0 sUg7C0N0csuXsSKzzKKTlgpt939oRQSl1mB15Z6YRa2r8irJv4rJGmNy3L+7hsKGoeeP qgRQ== X-Received: by 10.68.88.67 with SMTP id be3mr23379385pbb.187.1362963496204; Sun, 10 Mar 2013 17:58:16 -0700 (PDT) Received: from localhost ([159.226.5.132]) by mx.google.com with ESMTPS id rd1sm17728694pbc.19.2013.03.10.17.58.13 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Sun, 10 Mar 2013 17:58:15 -0700 (PDT) From: ycnian@gmail.com To: bfields@fieldses.org Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Yanchuan Nian Subject: [PATCH v2] nfsd: fix bug on nfs4 stateid deallocation Date: Mon, 11 Mar 2013 08:46:14 +0800 Message-Id: <1362962774-5141-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 NFS4_OO_PURGE_CLOSE is not handled properly. To avoid memory leak, nfs4 stateid which is pointed by oo_last_closed_stid is freed in nfsd4_close(), but NFS4_OO_PURGE_CLOSE isn't cleared meanwhile. So the stateid released in THIS close procedure may be freed immediately in the coming encoding function. Sorry that Signed-off-by was forgotten in last version. Signed-off-by: Yanchuan Nian --- fs/nfsd/nfs4state.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index cc41bf4..d972db8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3827,6 +3827,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, nfsd4_close_open_stateid(stp); release_last_closed_stateid(oo); + oo->oo_flags &= ~NFS4_OO_PURGE_CLOSE; oo->oo_last_closed_stid = stp; if (list_empty(&oo->oo_owner.so_stateids)) {