From patchwork Mon Jul 4 01:30:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Tao X-Patchwork-Id: 952992 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p67EEHMa022324 for ; Thu, 7 Jul 2011 14:14:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753389Ab1GGOOQ (ORCPT ); Thu, 7 Jul 2011 10:14:16 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:45571 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752825Ab1GGOOP (ORCPT ); Thu, 7 Jul 2011 10:14:15 -0400 Received: by iwn6 with SMTP id 6so871054iwn.19 for ; Thu, 07 Jul 2011 07:14:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=lKU8zF4UzGH3RWc2T1C1IyayzmZNdZRpm5uUbcNozTI=; b=d5RoIzJFj85HIV//s7FC24jzOyL1H1KZZcQPKbzkw9EeEhNhQWtGuOcA6m777WyypE zUV8ymdCsU2ibf1NBqz67DxsYQpSeo+qSVqbHcd9lffRSzLCEwgdy47yC2LlTZHgFlOT GfOgf2xROD4MjmPVI2AhH/+4MoPCdAJeCfyTE= Received: by 10.231.41.69 with SMTP id n5mr790772ibe.83.1310048055350; Thu, 07 Jul 2011 07:14:15 -0700 (PDT) Received: from debian-sid.localdomain ([123.115.214.147]) by mx.google.com with ESMTPS id c2sm3111328ibd.56.2011.07.07.07.14.09 (version=SSLv3 cipher=OTHER); Thu, 07 Jul 2011 07:14:13 -0700 (PDT) From: Peng Tao To: Trond.Myklebust@netapp.com Cc: linux-nfs@vger.kernel.org, Peng Tao Subject: [PATCH] NFS41: Drop lseg ref before fallthru to MDS Date: Sun, 3 Jul 2011 18:30:02 -0700 Message-Id: <1309743002-1658-1-git-send-email-bergwolf@gmail.com> X-Mailer: git-send-email 1.7.1.262.g5ef3d Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 07 Jul 2011 14:14:17 +0000 (UTC) There is no need to keep lseg reference when read/write through MDS. This fixes a null pointer crash at nfs_post_op_update_inode_force_wcc because nfs4_proc_write_setup will unset wdata->res.fattr if wdata->lseg is not NULL. Signed-off-by: Peng Tao --- fs/nfs/pnfs.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 30a0394..55fdf02 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1193,6 +1193,9 @@ pnfs_ld_write_done(struct nfs_write_data *data) dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__, data->pnfs_error); + + put_lseg(data->lseg); + data->lseg = NULL; status = nfs_initiate_write(data, NFS_CLIENT(data->inode), data->mds_ops, NFS_FILE_SYNC); return status ? : -EAGAIN; @@ -1240,6 +1243,9 @@ pnfs_ld_read_done(struct nfs_read_data *data) dprintk("%s: pnfs_error=%d, retry via MDS\n", __func__, data->pnfs_error); + + put_lseg(data->lseg); + data->lseg = NULL; status = nfs_initiate_read(data, NFS_CLIENT(data->inode), data->mds_ops); return status ? : -EAGAIN;