The Samba-Bugzilla – Attachment 6063 Details for
Bug 7792
cifsd stays running after umount
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch - don't take extra tlink reference in cifs_initiate_search
0001-cifs-don-t-take-extra-tlink-reference-in-initiate_ci.patch (text/plain), 2.28 KB, created by
Jeff Layton
on 2010-11-11 13:32:20 UTC
(
hide
)
Description:
patch - don't take extra tlink reference in cifs_initiate_search
Filename:
MIME Type:
Creator:
Jeff Layton
Created:
2010-11-11 13:32:20 UTC
Size:
2.28 KB
patch
obsolete
>From ca58a9c1c9d638dee4ee5f5c5961598b39e7ab9b Mon Sep 17 00:00:00 2001 >From: Jeff Layton <jlayton@redhat.com> >Date: Thu, 11 Nov 2010 14:28:24 -0500 >Subject: [PATCH] cifs: don't take extra tlink reference in initiate_cifs_search > >It's possible for initiate_cifs_search to be called on a filp that >already has private_data attached. If this happens, we'll end up >calling cifs_sb_tlink, taking an extra reference to the tlink and >attaching that to the cifsFileInfo. This leads to refcount leaks >that manifest as a "stuck" cifsd at umount time. > >Fix this by only looking up the tlink for the cifsFile on the filp's >first pass through this function. When called on a filp that already >has cifsFileInfo associated with it, just use the tlink reference >that it already owns. > >Signed-off-by: Jeff Layton <jlayton@redhat.com> >--- > fs/cifs/readdir.c | 28 ++++++++++++++++------------ > 1 files changed, 16 insertions(+), 12 deletions(-) > >diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c >index c8961c5..0d8bf97 100644 >--- a/fs/cifs/readdir.c >+++ b/fs/cifs/readdir.c >@@ -227,26 +227,30 @@ static int initiate_cifs_search(const int xid, struct file *file) > char *full_path = NULL; > struct cifsFileInfo *cifsFile; > struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); >- struct tcon_link *tlink; >+ struct tcon_link *tlink = NULL; > struct cifsTconInfo *pTcon; > >- tlink = cifs_sb_tlink(cifs_sb); >- if (IS_ERR(tlink)) >- return PTR_ERR(tlink); >- pTcon = tlink_tcon(tlink); >- >- if (file->private_data == NULL) >- file->private_data = >- kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); > if (file->private_data == NULL) { >- rc = -ENOMEM; >- goto error_exit; >+ tlink = cifs_sb_tlink(cifs_sb); >+ if (IS_ERR(tlink)) >+ return PTR_ERR(tlink); >+ >+ cifsFile = kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); >+ if (cifsFile == NULL) { >+ rc = -ENOMEM; >+ goto error_exit; >+ } >+ file->private_data = cifsFile; >+ cifsFile->tlink = cifs_get_tlink(tlink); >+ pTcon = tlink_tcon(tlink); >+ } else { >+ cifsFile = file->private_data; >+ pTcon = tlink_tcon(cifsFile->tlink); > } > > cifsFile = file->private_data; > cifsFile->invalidHandle = true; > cifsFile->srch_inf.endOfSearch = false; >- cifsFile->tlink = cifs_get_tlink(tlink); > > full_path = build_path_from_dentry(file->f_path.dentry); > if (full_path == NULL) { >-- >1.7.2.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 7792
:
6058
|
6059
|
6060
|
6061
|
6063
|
6064