mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: viro@parcelfarce.linux.theplanet.co.uk
To: Gene Heskett <gene.heskett@verizon.net>
Cc: linux-kernel@vger.kernel.org,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Subject: Re: Possible dcache BUG
Date: Sun, 15 Aug 2004 09:48:56 +0100	[thread overview]
Message-ID: <20040815084856.GD12308@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <200408150009.45034.gene.heskett@verizon.net>

On Sun, Aug 15, 2004 at 12:09:44AM -0400, Gene Heskett wrote:
> The only thing I've noted in the slabinfo reports is the ext3_cache 
> was well into 6 digits in kilobytes.  Now its only 15,000 of its 
> normal units (whatever they are) after the reboot.

What did dcache numbers look like at that time?

Anyway, we could try the patch below and see what shows in /proc/fs/ext3
with it [NOTE: patch is completely untested].  It should show
	major:minor:inumber:mode
for all currently allocated ext3 inodes.  It won't be 100% accurate (we
can miss some entries/get some twice if cache shrinks or grows at the
time), but if the leak is so massive, we ought to see a *lot* of duplicates
in there.  Seeing what kind of inodes really leaks could narrow the things
down.

See if cat /proc/fs/ext3 | sort | uniq -c | sort -nr gives anything interesting
when leak happens (and check it right after boot to see if it works at all
and doesn't oops, obviously ;-)

diff -urN RC8-current/fs/ext3/super.c RC8-leak/fs/ext3/super.c
--- RC8-current/fs/ext3/super.c	Sat Aug 14 05:35:37 2004
+++ RC8-leak/fs/ext3/super.c	Sun Aug 15 04:41:09 2004
@@ -35,6 +35,8 @@
 #include <linux/mount.h>
 #include <linux/namei.h>
 #include <linux/quotaops.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <asm/uaccess.h>
 #include "xattr.h"
 #include "acl.h"
@@ -438,6 +440,9 @@
 
 static kmem_cache_t *ext3_inode_cachep;
 
+static LIST_HEAD(ext3_list);
+static spinlock_t ext3_list_lock = SPIN_LOCK_UNLOCKED;
+
 /*
  * Called inside transaction, so use GFP_NOFS
  */
@@ -453,11 +458,17 @@
 	ei->i_default_acl = EXT3_ACL_NOT_CACHED;
 #endif
 	ei->vfs_inode.i_version = 1;
+	spin_lock(&ext3_list_lock);
+	list_add(&ei->list, &ext3_list);
+	spin_unlock(&ext3_list_lock);
 	return &ei->vfs_inode;
 }
 
 static void ext3_destroy_inode(struct inode *inode)
 {
+	spin_lock(&ext3_list_lock);
+	list_del_init(&EXT3_I(inode)->list);
+	spin_unlock(&ext3_list_lock);
 	kmem_cache_free(ext3_inode_cachep, EXT3_I(inode));
 }
 
@@ -475,20 +486,82 @@
 		inode_init_once(&ei->vfs_inode);
 	}
 }
+
+static void *ext3_cache_start(struct seq_file *m, loff_t *pos)
+{
+	struct list_head *p;
+	loff_t l = *pos;
+
+	spin_lock(&ext3_list_lock);
+	list_for_each(p, &ext3_list)
+		if (!l--)
+			return list_entry(p, struct ext3_inode_info, list);
+	return NULL;
+}
+
+static void *ext3_cache_next(struct seq_file *m, void *v, loff_t *pos)
+{
+	struct list_head *p = ((struct ext3_inode_info *)v)->list.next;
+	(*pos)++;
+	return p==&ext3_list ? NULL : list_entry(p, struct ext3_inode_info, list);
+}
+
+static void ext3_cache_stop(struct seq_file *m, void *v)
+{
+	spin_unlock(&ext3_list_lock);
+}
+
+static int ext3_cache_show(struct seq_file *m, void *v)
+{
+	struct ext3_inode_info *ei = v;
+	struct inode *inode = &ei->vfs_inode;
+	seq_printf(m, "%d:%d:%lu:%o",
+		MAJOR(inode->i_sb->s_dev),
+		MINOR(inode->i_sb->s_dev),
+		inode->i_ino,
+		inode->i_mode);
+	return 0;
+}
+
+static struct seq_operations ext3_cache_op = {
+	.start	= ext3_cache_start,
+	.next	= ext3_cache_next,
+	.stop	= ext3_cache_stop,
+	.show	= ext3_cache_show
+};
+
+static int ext3_cache_open(struct inode *inode, struct file *file)
+{
+	return seq_open(file, &ext3_cache_op);
+}
+
+static struct file_operations ext3_cache_operations = {
+	.open		= ext3_cache_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
  
 static int init_inodecache(void)
 {
+	struct proc_dir_entry *p;
 	ext3_inode_cachep = kmem_cache_create("ext3_inode_cache",
 					     sizeof(struct ext3_inode_info),
 					     0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
 					     init_once, NULL);
 	if (ext3_inode_cachep == NULL)
 		return -ENOMEM;
+	p = create_proc_entry("fs/ext3", S_IRUGO, NULL);
+	if (p) {
+		p->owner = THIS_MODULE;
+		p->proc_fops = &ext3_cache_operations;
+	}
 	return 0;
 }
 
 static void destroy_inodecache(void)
 {
+	remove_proc_entry("fs/ext3", NULL);
 	if (kmem_cache_destroy(ext3_inode_cachep))
 		printk(KERN_INFO "ext3_inode_cache: not all structures were freed\n");
 }
diff -urN RC8-current/include/linux/ext3_fs_i.h RC8-leak/include/linux/ext3_fs_i.h
--- RC8-current/include/linux/ext3_fs_i.h	Thu Oct  9 17:34:54 2003
+++ RC8-leak/include/linux/ext3_fs_i.h	Sun Aug 15 04:11:03 2004
@@ -107,6 +107,7 @@
 	 * by other means, so we have truncate_sem.
 	 */
 	struct semaphore truncate_sem;
+	struct list_head list;
 	struct inode vfs_inode;
 };
 

  reply	other threads:[~2004-08-15  8:49 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-02 13:14 Brett Charbeneau
2004-08-05  2:16 ` Gene Heskett
2004-08-05  3:46   ` Andrew Morton
2004-08-05  4:31     ` Gene Heskett
2004-08-05  0:44       ` Chris Shoemaker
2004-08-05  8:35         ` Denis Vlasenko
2004-08-05 14:14           ` Gene Heskett
2004-08-05 13:48         ` Gene Heskett
     [not found]           ` <200408210118.02011.vda@port.imtp.ilyichevsk.odessa.ua>
2004-08-21  1:40             ` Gene Heskett
2004-08-05  8:33       ` Denis Vlasenko
2004-08-05 14:19         ` Gene Heskett
     [not found]           ` <200408070203.35268.vda@port.imtp.ilyichevsk.odessa.ua>
2004-08-07  1:28             ` Gene Heskett
2004-08-05 21:26         ` Chris Shoemaker
2004-08-05  7:25   ` Linus Torvalds
2004-08-05  7:31     ` Andrew Morton
2004-08-05  8:33     ` Denis Vlasenko
2004-08-05 14:55       ` Gene Heskett
2004-08-05 16:26       ` Linus Torvalds
2004-08-05 18:06         ` Ingo Molnar
2004-08-05 18:50           ` Linus Torvalds
2004-08-05 20:29             ` Andi Kleen
     [not found]             ` <20040806073739.GA6617@elte.hu>
     [not found]               ` <20040806004231.143c8bd2.akpm@osdl.org>
2004-08-06  8:27                 ` Ingo Molnar
2004-08-06 11:51                 ` Gene Heskett
2004-08-06 16:58                   ` Linus Torvalds
2004-08-06 17:16                     ` Gene Heskett
2004-08-06 17:26                       ` William Lee Irwin III
2004-08-06 23:19                         ` Chris Shoemaker
2004-08-07  4:15                           ` William Lee Irwin III
2004-08-07  0:05                             ` Chris Shoemaker
2004-08-07  5:50                               ` William Lee Irwin III
2004-08-06 23:09                     ` Chris Shoemaker
2004-08-07  6:20                       ` Linus Torvalds
2004-08-07 12:38                         ` Gene Heskett
2004-08-07 13:44                         ` Chris Shoemaker
2004-08-07 18:49                           ` Linus Torvalds
2004-08-07 19:01                           ` Gene Heskett
2004-08-06 11:31               ` Andi Kleen
2004-08-06 17:16               ` Linus Torvalds
2004-08-05 21:10         ` Chris Shoemaker
2004-08-06  2:03         ` Gene Heskett
2004-08-06  2:12         ` Gene Heskett
2004-08-06  2:50     ` Linus Torvalds
2004-08-06  3:18       ` viro
2004-08-06  3:24         ` Linus Torvalds
2004-08-08  4:42           ` Gene Heskett
2004-08-08 14:30           ` Gene Heskett
2004-08-08 18:39             ` Andrew Morton
2004-08-10  4:12               ` Gene Heskett
2004-08-11  3:42                 ` Gene Heskett
2004-08-11  3:46                   ` Linus Torvalds
2004-08-11  4:18                     ` Udo A. Steinberg
2004-08-11  5:13                       ` Linus Torvalds
2004-08-11  5:15                         ` Linus Torvalds
2004-08-11  5:33                           ` Udo A. Steinberg
2004-08-11 14:37                           ` Gene Heskett
2004-08-12  1:26                             ` Nick Piggin
2004-08-12  2:23                               ` Gene Heskett
2004-08-12  2:36                                 ` Nick Piggin
2004-08-13  1:00                           ` Udo A. Steinberg
2004-08-13  1:31                             ` Linus Torvalds
2004-08-13  2:03                               ` Gene Heskett
2004-08-13  2:27                               ` Andreas Dilger
2004-08-13  3:33                                 ` Linus Torvalds
2004-08-20  7:02                               ` Udo A. Steinberg
2004-08-20  7:11                                 ` Andrew Morton
2004-08-20  7:19                                   ` Udo A. Steinberg
2004-08-20  7:49                                     ` Nick Piggin
2004-08-24  6:08                                       ` Udo A. Steinberg
2004-08-24  7:41                                         ` Nick Piggin
2004-08-24 18:20                                           ` Marcelo Tosatti
2004-08-24 20:00                                             ` Andrew Morton
2004-08-24 18:40                                               ` Marcelo Tosatti
2004-08-25  0:27                                                 ` Marcelo Tosatti
2004-09-12  7:03                               ` Udo A. Steinberg
2004-09-12  7:16                                 ` Andrew Morton
2004-09-12  7:29                                   ` Udo A. Steinberg
2004-09-12  7:48                                     ` Andrew Morton
2004-09-13  4:53                                       ` Len Brown
2004-08-11  5:55                         ` David S. Miller
2004-08-11  4:47                     ` Gene Heskett
2004-08-11  4:59                       ` Linus Torvalds
2004-08-11  8:05                         ` Roger Luethi
2004-08-13  4:27                         ` Gene Heskett
2004-08-13  8:32                           ` Gene Heskett
2004-08-14  2:18                           ` Marcelo Tosatti
2004-08-14  5:19                             ` Gene Heskett
2004-08-14  5:50                             ` Gene Heskett
2004-08-14  8:17                             ` Gene Heskett
2004-08-15  4:09                               ` Gene Heskett
2004-08-15  8:48                                 ` viro [this message]
2004-08-15  9:42                                   ` Gene Heskett
2004-08-15 17:31                                     ` Andrew Morton
2004-08-15 17:58                                       ` Gene Heskett
2004-08-15  9:50                                   ` Gene Heskett
2004-08-15 10:36                                     ` viro
2004-08-15 10:10                                   ` Gene Heskett
2004-08-15 10:37                                     ` viro
2004-08-15 10:42                                       ` Gene Heskett
2004-08-15 11:00                                         ` viro
     [not found]                                       ` <200408150704.49312.gene.heskett@verizon.net>
2004-08-15 11:26                                         ` viro
2004-08-15 17:47                                           ` Gene Heskett
     [not found]                                             ` <200408152257.04773.vda@port.imtp.ilyichevsk.odessa.ua>
2004-08-15 20:33                                               ` Gene Heskett
     [not found]                                                 ` <200408160803.15206.vda@port.imtp.ilyichevsk.odessa.ua>
2004-08-16  6:32                                                   ` Gene Heskett
2004-08-16 14:13                                                     ` Gene Heskett
     [not found]                                                       ` <200408161749.23663.vda@port.imtp.ilyichevsk.odessa.ua>
2004-08-16 15:25                                                         ` Gene Heskett
2004-08-16 22:52                                   ` Gene Heskett
2004-08-16 23:01                                     ` viro
2004-08-17  4:44                                       ` Gene Heskett
2004-08-17  4:58                                         ` Nick Piggin
2004-08-17  5:26                                           ` Gene Heskett
2004-08-17 11:57                                             ` Nick Piggin
2004-08-19  9:41                                               ` Gene Heskett
2004-08-19 18:36                                                 ` Marcelo Tosatti
2004-08-20  2:38                                                   ` Gene Heskett
2004-08-20  7:33                                                     ` Marcelo Tosatti
2004-08-20 15:06                                                       ` Gene Heskett
2004-08-20 15:43                                                         ` V13
2004-08-20 17:29                                                           ` Gene Heskett
2004-08-20 18:13                                                             ` Marc Ballarin
2004-08-20 20:08                                                               ` Gene Heskett
2004-08-21  9:25                                                                 ` Barry K. Nathan
2004-08-21 18:31                                                                   ` V13
2004-08-21 18:55                                                                     ` Gene Heskett
2004-08-22 11:04                                                                       ` Helge Hafting
2004-08-22 11:40                                                                         ` Gene Heskett
2004-08-20 20:11                                                             ` R. J. Wysocki
2004-08-20 20:17                                                               ` Gene Heskett
2004-08-22  5:05                                                                 ` Gene Heskett
2004-08-22 11:42                                                                   ` R. J. Wysocki
2004-08-24  2:34                                                                   ` Tom Vier
2004-08-24  3:08                                                                     ` Gene Heskett
2004-08-25  1:49                                                                       ` Tom Vier
2004-08-25  2:33                                                                         ` Gene Heskett
2004-08-25 14:55                                                                           ` Martin J. Bligh
2004-08-25 17:23                                                                             ` Ryan Cumming
2004-08-25 17:36                                                                               ` Martin J. Bligh
2004-08-27 14:01                                                                           ` Gene Heskett
2004-08-25  6:13                                                                         ` Denis Vlasenko
2004-08-29 13:48                                                                           ` Gene Heskett
2004-08-29 14:34                                                                             ` Possible dcache BUG [u] Martin Schlemmer [c]
2004-08-29 15:21                                                                             ` Possible dcache BUG Rafael J. Wysocki
2004-08-29 17:23                                                                               ` Denis Vlasenko
2004-08-29 22:25                                                                                 ` Gene Heskett
2004-08-05 14:54 Brett Charbeneau
     [not found] <2oKTA-5CQ-65@gated-at.bofh.it>
     [not found] ` <2r0U7-3yx-9@gated-at.bofh.it>
     [not found]   ` <2rwhh-BX-15@gated-at.bofh.it>
     [not found]     ` <2rShM-7QP-5@gated-at.bofh.it>
     [not found]       ` <2rSrs-7Vn-1@gated-at.bofh.it>
     [not found]         ` <2rSUw-8lw-3@gated-at.bofh.it>
     [not found]           ` <2rTGR-se-3@gated-at.bofh.it>
     [not found]             ` <2rUjF-Od-11@gated-at.bofh.it>
2004-08-11 12:32               ` Andi Kleen
2004-08-20  8:08 Daniel Blueman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040815084856.GD12308@parcelfarce.linux.theplanet.co.uk \
    --to=viro@parcelfarce.linux.theplanet.co.uk \
    --cc=akpm@osdl.org \
    --cc=gene.heskett@verizon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome