linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
To: linux-nfs@vger.kernel.org
Cc: bhalevy@panasas.com
Subject: [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint
Date: Wed, 12 May 2010 15:42:04 +0800	[thread overview]
Message-ID: <20100512074204.GA7643@MDS-78.localdomain> (raw)

initialize_mountpoint will call _nfs4_pnfs_getdevicelist and then
pnfs_curr_ld->id is accessed. This introduce a NULL pointer reference.

Signed-off-by: Zhang Jingwang <zhangjingwang@nrchpc.ac.cn>
---
 fs/nfs/pnfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3739c38..5ad7fc6 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -212,6 +212,7 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
 		return;
 
 	if (id > 0 && find_pnfs(id, &mod)) {
+		server->pnfs_curr_ld = mod->pnfs_ld_type;
 		if (mod->pnfs_ld_type->ld_io_ops->initialize_mountpoint(
 							server, mntfh)) {
 			printk(KERN_ERR "%s: Error initializing mount point "
@@ -222,7 +223,6 @@ set_pnfs_layoutdriver(struct nfs_server *server, const struct nfs_fh *mntfh,
 		 * Layout driver succeeded in initializing mountpoint
 		 * and has taken a reference on the nfs_client cl_devid_cache
 		 */
-		server->pnfs_curr_ld = mod->pnfs_ld_type;
 		server->nfs_client->rpc_ops = &pnfs_v4_clientops;
 		dprintk("%s: pNFS module for %u set\n", __func__, id);
 		return;
-- 
1.6.2.5


             reply	other threads:[~2010-05-12  7:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12  7:42 Zhang Jingwang [this message]
2010-05-12 14:11 ` [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint William A. (Andy) Adamson
2010-05-13  3:01   ` Zhang Jingwang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100512074204.GA7643@MDS-78.localdomain \
    --to=zhangjingwang@nrchpc.ac.cn \
    --cc=bhalevy@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).