linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint
@ 2010-05-12  7:42 Zhang Jingwang
  2010-05-12 14:11 ` William A. (Andy) Adamson
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Jingwang @ 2010-05-12  7:42 UTC (permalink / raw)
  To: linux-nfs; +Cc: bhalevy

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint
  2010-05-12  7:42 [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint Zhang Jingwang
@ 2010-05-12 14:11 ` William A. (Andy) Adamson
  2010-05-13  3:01   ` Zhang Jingwang
  0 siblings, 1 reply; 3+ messages in thread
From: William A. (Andy) Adamson @ 2010-05-12 14:11 UTC (permalink / raw)
  To: Zhang Jingwang; +Cc: linux-nfs, bhalevy

On Wed, May 12, 2010 at 3:42 AM, Zhang Jingwang
<zhangjingwang@nrchpc.ac.cn> wrote:
> 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

> 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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint
  2010-05-12 14:11 ` William A. (Andy) Adamson
@ 2010-05-13  3:01   ` Zhang Jingwang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang Jingwang @ 2010-05-13  3:01 UTC (permalink / raw)
  To: William A. (Andy) Adamson; +Cc: linux-nfs, bhalevy

2010/5/12 William A. (Andy) Adamson <androsadamson@gmail.com>:
> On Wed, May 12, 2010 at 3:42 AM, Zhang Jingwang
> <zhangjingwang@nrchpc.ac.cn> wrote:
>> 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.

>
> -->Andy
>
>> 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
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-13  3:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12  7:42 [PATCH] pnfs: set pnfs_curr_ld before calling initialize_mountpoint Zhang Jingwang
2010-05-12 14:11 ` William A. (Andy) Adamson
2010-05-13  3:01   ` Zhang Jingwang

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).