mtd/fs/jffs2 fs.c,1.6,1.7

David Woodhouse dwmw2 at infradead.org
Wed Apr 3 04:03:11 EST 2002


Update of /home/cvs/mtd/fs/jffs2
In directory phoenix.infradead.org:/tmp/cvs-serv11624

Modified Files:
	fs.c 
Log Message:
Don't deadlock in write_super when do_reserve_space is waiting for erases.


Index: fs.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/fs.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- fs.c	27 Mar 2002 09:57:24 -0000	1.6
+++ fs.c	3 Apr 2002 09:03:09 -0000	1.7
@@ -326,12 +326,18 @@
 		return;
 
 	D1(printk(KERN_DEBUG "jffs2_write_super(): flush_wbuf before gc-trigger\n"));
-	down(&c->alloc_sem);
-	jffs2_flush_wbuf(c, 2);
-	up(&c->alloc_sem);
 	jffs2_garbage_collect_trigger(c);
 	jffs2_erase_pending_blocks(c);
 	jffs2_mark_erased_blocks(c);
+	/* Eep. If we lock this here, we deadlock with jffs2_reserve_space() when
+	 * it locks the alloc_sem and jffs2_do_reserve_space() waits for erases
+	 * to happen. I think the erases and/or the flush_wbuf want doing from
+	 *
+	 */
+	if (!down_trylock(&c->alloc_sem)) {
+		jffs2_flush_wbuf(c, 2);
+		up(&c->alloc_sem);
+	} // else it stays dirty. FIXME.
 }
 
 





More information about the linux-mtd-cvs mailing list