Skip to contentSkip to conversation

pnfs: set pnfs_curr_ld before calling initialize_mountpoint

PATCH In review Zhang Jingwang 3 participants 3 messages May 12, 2010 – May 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pnfs: set pnfs_curr_ld before calling initialize_mountpoint

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

---
 fs/nfs/pnfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/pnfs.c +1 -1
index 3739c38..5ad7fc6 100644
@@ -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;
Signature · 1 line
1.6.2.5
#1 lore raw
Quoted 2 lines · Zhang Jingwang

initialize_mountpoint will call _nfs4_pnfs_getdevicelist and then pnfs_curr_ld->id is accessed.

Where is pnfs_curr_ld->ld_policy_ops accessed?

-->Andy

Quoted 35 lines

This introduce a NULL pointer reference.

---
 fs/nfs/pnfs.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/pnfs.c +1 -0
index 3739c38..5ad7fc6 100644
@@ -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 "

fs/nfs/pnfs.c +0 -2
@@ -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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw

2010/5/12 William A. (Andy) Adamson <[email protected]>:

Quoted 6 lines
Quoted 2 lines · Zhang Jingwang

initialize_mountpoint will call _nfs4_pnfs_getdevicelist and then pnfs_curr_ld->id is accessed.

Where is pnfs_curr_ld->ld_policy_ops accessed?

In pnfs_set_ds_iosize after set_pnfs_layoutdriver, pnfs_curr_ld is set in set_pnfs_layoutdriver so it's OK to access pnfs_curr_ld->ld_policy_ops.

Quoted 43 lines

-->Andy

Quoted 30 lines

This introduce a NULL pointer reference.

---
 fs/nfs/pnfs.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfs/pnfs.c +1 -0
index 3739c38..5ad7fc6 100644
@@ -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 "

fs/nfs/pnfs.c +0 -2
@@ -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

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Zhang Jingwang
National Research Centre for High Performance Computers
Institute of Computing Technology, Chinese Academy of Sciences
No. 6, South Kexueyuan Road, Haidian District
Beijing, China