[JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Jun 27 11:59:02 EDT 2006
Commit: 355ed4e141203fd7266ef9d90d57be0c61bd1aa4
Parent: 8a13695cbe4e8311b363f9bd25162904b984ca74
commit 355ed4e141203fd7266ef9d90d57be0c61bd1aa4
Author: KaiGai Kohei <kaigai at ak.jp.nec.com>
AuthorDate: Sat Jun 24 09:15:36 2006 +0900
Commit: David Woodhouse <dwmw2 at infradead.org>
CommitDate: Tue Jun 27 16:18:30 2006 +0100
[JFFS2][XATTR] Fix memory leak with jffs2_xattr_ref
If xattr_ref is associated with an orphan inode_cache
on filesystem mounting, those xattr_refs are not
released even if this inode_cache is released.
This patch enables to call jffs2_xattr_delete_inode()
for such a irregular inode_cachde too.
Signed-off-by: KaiGai Kohei <kaigai at ak.jp.nec.com>
Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
fs/jffs2/fs.c | 2 --
fs/jffs2/gc.c | 1 +
fs/jffs2/nodelist.c | 3 +++
fs/jffs2/readinode.c | 1 +
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 2900ec3..97caa77 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -227,8 +227,6 @@ void jffs2_clear_inode (struct inode *in
struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
D1(printk(KERN_DEBUG "jffs2_clear_inode(): ino #%lu mode %o\n", inode->i_ino, inode->i_mode));
-
- jffs2_xattr_delete_inode(c, f->inocache);
jffs2_do_clear_inode(c, f);
}
diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
index f59b147..daff334 100644
--- a/fs/jffs2/gc.c
+++ b/fs/jffs2/gc.c
@@ -165,6 +165,7 @@ int jffs2_garbage_collect_pass(struct jf
D1(printk(KERN_DEBUG "Skipping check of ino #%d with nlink zero\n",
ic->ino));
spin_unlock(&c->inocache_lock);
+ jffs2_xattr_delete_inode(c, ic);
continue;
}
switch(ic->state) {
diff --git a/fs/jffs2/nodelist.c b/fs/jffs2/nodelist.c
index 927dfe4..7675b33 100644
--- a/fs/jffs2/nodelist.c
+++ b/fs/jffs2/nodelist.c
@@ -906,6 +906,9 @@ void jffs2_del_ino_cache(struct jffs2_sb
{
struct jffs2_inode_cache **prev;
+#ifdef CONFIG_JFFS2_FS_XATTR
+ BUG_ON(old->xref);
+#endif
dbg_inocache("del %p (ino #%u)\n", old, old->ino);
spin_lock(&c->inocache_lock);
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c
index 5fec012..cc18992 100644
--- a/fs/jffs2/readinode.c
+++ b/fs/jffs2/readinode.c
@@ -968,6 +968,7 @@ void jffs2_do_clear_inode(struct jffs2_s
struct jffs2_full_dirent *fd, *fds;
int deleted;
+ jffs2_xattr_delete_inode(c, f->inocache);
down(&f->sem);
deleted = f->inocache && !f->inocache->nlink;
More information about the linux-mtd-cvs
mailing list