/[linux-patches]/genpatches-2.6/trunk/2.6.14/1418_15.4_nfs-inode-leakage.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1418_15.4_nfs-inode-leakage.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 328 - (show annotations) (download) (as text)
Tue Mar 14 13:34:17 2006 UTC (14 years, 8 months ago) by johnm
File MIME type: text/x-diff
File size: 1917 byte(s)
2.6.14-11, rebase against local tree
1 From stable-bounces@linux.kernel.org Tue Jan 31 16:38:43 2006
2 Date: Tue, 10 Jan 2006 09:28:45 -0800
3 From: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
4 To: git-commits-head@vger.kernel.org
5 Cc:
6 Subject: [PATCH] d_instantiate_unique / NFS inode leakage
7
8 From: Oleg Drokin <green@linuxhacker.ru>
9
10 If we have found aliased dentry that we return, inode reference is not
11 dropped and inode is not attached anywhere, so it seems the reference to
12 inode is leaked in that case.
13
14 Cc: Trond Myklebust <trond.myklebust@fys.uio.no>,
15 Cc: <viro@parcelfarce.linux.theplanet.co.uk>
16 Cc: Christoph Hellwig <hch@lst.de>
17 Signed-off-by: Andrew Morton <akpm@osdl.org>
18 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
19 Signed-off-by: Chris Wright <chrisw@sous-sol.org>
20 ---
21
22 fs/dcache.c | 7 ++++++-
23 1 files changed, 6 insertions(+), 1 deletion(-)
24
25 Index: linux-2.6.15.2/fs/dcache.c
26 ===================================================================
27 --- linux-2.6.15.2.orig/fs/dcache.c
28 +++ linux-2.6.15.2/fs/dcache.c
29 @@ -808,10 +808,14 @@ void d_instantiate(struct dentry *entry,
30 *
31 * Fill in inode information in the entry. On success, it returns NULL.
32 * If an unhashed alias of "entry" already exists, then we return the
33 - * aliased dentry instead.
34 + * aliased dentry instead and drop one reference to inode.
35 *
36 * Note that in order to avoid conflicts with rename() etc, the caller
37 * had better be holding the parent directory semaphore.
38 + *
39 + * This also assumes that the inode count has been incremented
40 + * (or otherwise set) by the caller to indicate that it is now
41 + * in use by the dcache.
42 */
43 struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode)
44 {
45 @@ -838,6 +842,7 @@ struct dentry *d_instantiate_unique(stru
46 dget_locked(alias);
47 spin_unlock(&dcache_lock);
48 BUG_ON(!d_unhashed(alias));
49 + iput(inode);
50 return alias;
51 }
52 list_add(&entry->d_alias, &inode->i_dentry);

  ViewVC Help
Powered by ViewVC 1.1.20