From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Venkateswararao Jujjuri (JV)" Subject: Re: [PATCH] [fs/9p] Check for NULL fid in v9fs_dir_release() Date: Thu, 26 Aug 2010 08:13:41 -0700 Message-ID: <4C7684A5.9080204@linux.vnet.ibm.com> References: <1282753581-28231-1-git-send-email-jvrao@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org To: "Aneesh Kumar K. V" Return-path: Received: from e4.ny.us.ibm.com ([32.97.182.144]:47069 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752012Ab0HZPNp (ORCPT ); Thu, 26 Aug 2010 11:13:45 -0400 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o7QEwq3m022622 for ; Thu, 26 Aug 2010 10:58:52 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d01relay04.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o7QFDixI073024 for ; Thu, 26 Aug 2010 11:13:44 -0400 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o7QFDhrp025873 for ; Thu, 26 Aug 2010 09:13:44 -0600 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Aneesh Kumar K. V wrote: > On Wed, 25 Aug 2010 09:26:21 -0700, "Venkateswararao Jujjuri (JV)" 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 >> --- >> 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: [] v9fs_dir_release+0x29/0x2f [] fput+0x13a/0x1ec [] ? v9fs_open_created+0x0/0xd [] __dentry_open+0x1d3/0x29e [] lookup_instantiate_filp+0x6b/0x8c [] v9fs_vfs_create_dotl+0x1a7/0x20d [] vfs_create+0x70/0x92 [] do_last+0x2e0/0x605 [] do_filp_open+0x1f8/0x5f8 [] ? mem_cgroup_charge_common+0x6a/0x7a [] ? might_fault+0x21/0x23 [] ? __strncpy_from_user+0x1e/0x49 [] ? alloc_fd+0x7b/0x124 [] do_sys_open+0x63/0x10f [] sys_open+0x20/0x22 [] system_call_fastpath+0x16/0x1b > > -aneesh