Skip to contentSkip to conversation

problems with JFFS2 assert failure on mutex

PATCH Øyvind Harboe 2 participants 3 messages Jul 19, 2004 – Jul 20, 2004 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

I was working on a different problem when I came across a mutex that was being obtained twice(discovered via eCos asserts).

On the surface of it, this patch looks correct.

Comments?

Signature · 2 lines
Øyvind Harboe
http://www.zylin.com

Index: gc.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/fs/jffs2/current/src/gc.c,v retrieving revision 1.7

gc.c +4 -4
diff -w -u -r1.7 gc.c
@@ -358,10 +358,10 @@
 	spin_unlock(&c->inocache_lock);
 
 	f = jffs2_gc_fetch_inode(c, inum, nlink);
-	if (IS_ERR(f))
-		return PTR_ERR(f);
-	if (!f)
-		return 0;
+	if (!f||IS_ERR(f)) {
+	  up(&c->alloc_sem);
+		return f;
+	}
 
 	ret = jffs2_garbage_collect_live(c, jeb, raw, f);
 
#1 lore raw
Quoted 4 lines · Øyvind Harboe

I was working on a different problem when I came across a mutex that was being obtained twice(discovered via eCos asserts).

On the surface of it, this patch looks correct.

Looks correct; I've committed an equivalent to CVS. Thanks.

Quoted 1 line

Comments?

Only that this error path should never happen. The call to jffs2_gc_fetch_inode() for a valid inode should _never_ fail.

Signature · 1 line
dwmw2
#2 lore raw

tir, 20.07.2004 kl. 15.41 skrev David Woodhouse:

Quoted 12 lines · Øyvind Harboe
Quoted 4 lines

I was working on a different problem when I came across a mutex that was being obtained twice(discovered via eCos asserts).

On the surface of it, this patch looks correct.

Looks correct; I've committed an equivalent to CVS. Thanks.

Quoted 1 line

Comments?

Only that this error path should never happen. The call to jffs2_gc_fetch_inode() for a valid inode should _never_ fail.

I believe this was with a corrupt JFFS2 disk.

Signature · 2 lines
Øyvind Harboe
http://www.zylin.com