linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release()
@ 2010-08-25 16:26 Venkateswararao Jujjuri (JV)
  2010-08-26  6:21 ` Aneesh Kumar K. V
  0 siblings, 1 reply; 3+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2010-08-25 16:26 UTC (permalink / raw)
  To: v9fs-developer; +Cc: linux-fsdevel, Venkateswararao Jujjuri (JV)

NULL fid should be handled in cases where we endup calling v9fs_dir_release()
before even we instantiate the fid in filp.

Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
---
 fs/9p/vfs_dir.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
index 16c8a2a..899f168 100644
--- a/fs/9p/vfs_dir.c
+++ b/fs/9p/vfs_dir.c
@@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
 
 	fid = filp->private_data;
 	P9_DPRINTK(P9_DEBUG_VFS,
-			"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
+			"v9fs_dir_release: inode: %p filp: %p fid: %d\n",
+			inode, filp, fid ? fid->fid : -1);
 	filemap_write_and_wait(inode->i_mapping);
-	p9_client_clunk(fid);
+	if (fid)
+		p9_client_clunk(fid);
 	return 0;
 }
 
-- 
1.6.5.2


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

* Re: [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release()
  2010-08-25 16:26 [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release() Venkateswararao Jujjuri (JV)
@ 2010-08-26  6:21 ` Aneesh Kumar K. V
  2010-08-26 15:13   ` Venkateswararao Jujjuri (JV)
  0 siblings, 1 reply; 3+ messages in thread
From: Aneesh Kumar K. V @ 2010-08-26  6:21 UTC (permalink / raw)
  To: Venkateswararao Jujjuri (JV), v9fs-developer
  Cc: linux-fsdevel, Venkateswararao Jujjuri (JV)

On Wed, 25 Aug 2010 09:26:21 -0700, "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com> wrote:
> NULL fid should be handled in cases where we endup calling v9fs_dir_release()
> before even we instantiate the fid in filp.
> 
> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
> ---
>  fs/9p/vfs_dir.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
> index 16c8a2a..899f168 100644
> --- a/fs/9p/vfs_dir.c
> +++ b/fs/9p/vfs_dir.c
> @@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
> 
>  	fid = filp->private_data;
>  	P9_DPRINTK(P9_DEBUG_VFS,
> -			"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
> +			"v9fs_dir_release: inode: %p filp: %p fid: %d\n",
> +			inode, filp, fid ? fid->fid : -1);
>  	filemap_write_and_wait(inode->i_mapping);
> -	p9_client_clunk(fid);
> +	if (fid)
> +		p9_client_clunk(fid);
>  	return 0;
>  }
> 

Can you get a stack trace where we end up calling dir_release with null
fid

-aneesh

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

* Re: [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release()
  2010-08-26  6:21 ` Aneesh Kumar K. V
@ 2010-08-26 15:13   ` Venkateswararao Jujjuri (JV)
  0 siblings, 0 replies; 3+ messages in thread
From: Venkateswararao Jujjuri (JV) @ 2010-08-26 15:13 UTC (permalink / raw)
  To: Aneesh Kumar K. V; +Cc: v9fs-developer, linux-fsdevel

Aneesh Kumar K. V wrote:
> On Wed, 25 Aug 2010 09:26:21 -0700, "Venkateswararao Jujjuri (JV)" <jvrao@linux.vnet.ibm.com> wrote:
>> NULL fid should be handled in cases where we endup calling v9fs_dir_release()
>> before even we instantiate the fid in filp.
>>
>> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
>> ---
>>  fs/9p/vfs_dir.c |    6 ++++--
>>  1 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c
>> index 16c8a2a..899f168 100644
>> --- a/fs/9p/vfs_dir.c
>> +++ b/fs/9p/vfs_dir.c
>> @@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp)
>>
>>  	fid = filp->private_data;
>>  	P9_DPRINTK(P9_DEBUG_VFS,
>> -			"inode: %p filp: %p fid: %d\n", inode, filp, fid->fid);
>> +			"v9fs_dir_release: inode: %p filp: %p fid: %d\n",
>> +			inode, filp, fid ? fid->fid : -1);
>>  	filemap_write_and_wait(inode->i_mapping);
>> -	p9_client_clunk(fid);
>> +	if (fid)
>> +		p9_client_clunk(fid);
>>  	return 0;
>>  }
>>
> 
> Can you get a stack trace where we end up calling dir_release with null
> fid

Aneesh, I posted the stack trace few days back... Subject of that patch might be
different..
as we moved the fix between dir_release() and clunk(). Here is the stack.

Call Trace:
 [<ffffffff81209cb1>] v9fs_dir_release+0x29/0x2f
 [<ffffffff81105985>] fput+0x13a/0x1ec
 [<ffffffff81207e97>] ? v9fs_open_created+0x0/0xd
 [<ffffffff811031bd>] __dentry_open+0x1d3/0x29e
 [<ffffffff811033d3>] lookup_instantiate_filp+0x6b/0x8c
 [<ffffffff81208fc6>] v9fs_vfs_create_dotl+0x1a7/0x20d
 [<ffffffff8110e30a>] vfs_create+0x70/0x92
 [<ffffffff8110eddc>] do_last+0x2e0/0x605
 [<ffffffff8110f553>] do_filp_open+0x1f8/0x5f8
 [<ffffffff811019e7>] ? mem_cgroup_charge_common+0x6a/0x7a
 [<ffffffff8125e933>] ? might_fault+0x21/0x23
 [<ffffffff8125ea32>] ? __strncpy_from_user+0x1e/0x49
 [<ffffffff81118ec2>] ? alloc_fd+0x7b/0x124
 [<ffffffff81102ef2>] do_sys_open+0x63/0x10f
 [<ffffffff81102fd1>] sys_open+0x20/0x22
 [<ffffffff81009c32>] system_call_fastpath+0x16/0x1b

> 
> -aneesh



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

end of thread, other threads:[~2010-08-26 15:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-25 16:26 [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release() Venkateswararao Jujjuri (JV)
2010-08-26  6:21 ` Aneesh Kumar K. V
2010-08-26 15:13   ` Venkateswararao Jujjuri (JV)

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