mtd/fs/jffs2 build.c,1.70,1.71 super.c,1.106,1.107

Artem Bityuckiy dedekind at infradead.org
Tue Jul 12 12:37:12 EDT 2005


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

Modified Files:
	build.c super.c 
Log Message:
[JFFS2] init JFFS2 SB (c->) locks earlier

If during mount an error occurs, and it accrues before jffs2_do_mount_fs()
is called, JFFS2 "hangs". It hangs, for example, in case of the following
calls sequence:

jffs2_get_sb_mtd() ->
jffs2_do_fill_super() (here we have an error) ->
deactivate_super()->
jffs2_kill_sb()->
jffs2_stop_garbage_collect_thread() - "hang" when trying to acquire
uninitialized c->erase_completion_lock.

Probably this is not the only error case. To fix this we move the
initialization of c->'s locks to the earlier point (at jffs2_get_sb_mtd()).



Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- build.c	28 Feb 2005 08:21:05 -0000	1.70
+++ build.c	12 Jul 2005 16:37:08 -0000	1.71
@@ -336,13 +336,6 @@
 		c->blocks[i].bad_count = 0;
 	}
 
-	init_MUTEX(&c->alloc_sem);
-	init_MUTEX(&c->erase_free_sem);
-	init_waitqueue_head(&c->erase_wait);
-	init_waitqueue_head(&c->inocache_wq);
-	spin_lock_init(&c->erase_completion_lock);
-	spin_lock_init(&c->inocache_lock);
-
 	INIT_LIST_HEAD(&c->clean_list);
 	INIT_LIST_HEAD(&c->very_dirty_list);
 	INIT_LIST_HEAD(&c->dirty_list);

Index: super.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/super.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- super.c	18 May 2005 11:37:25 -0000	1.106
+++ super.c	12 Jul 2005 16:37:08 -0000	1.107
@@ -140,6 +140,15 @@
 	D1(printk(KERN_DEBUG "jffs2_get_sb_mtd(): New superblock for device %d (\"%s\")\n",
 		  mtd->index, mtd->name));
 
+	/* Initialize JFFS2 superblock locks, the further initialization will be
+	 * done later */
+	init_MUTEX(&c->alloc_sem);
+	init_MUTEX(&c->erase_free_sem);
+	init_waitqueue_head(&c->erase_wait);
+	init_waitqueue_head(&c->inocache_wq);
+	spin_lock_init(&c->erase_completion_lock);
+	spin_lock_init(&c->inocache_lock);
+
 	sb->s_op = &jffs2_super_operations;
 	sb->s_flags = flags | MS_NOATIME;
 





More information about the linux-mtd-cvs mailing list