]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[JFFS2] Init locks early during mount
authorArtem B. Bityuckiy <dedekind@infradead.org>
Tue, 12 Jul 2005 16:37:12 +0000 (17:37 +0100)
committerThomas Gleixner <tglx@mtd.linutronix.de>
Tue, 12 Jul 2005 22:02:33 +0000 (00:02 +0200)
In case of a mount error locks might be uninitialized but
accessed by the resulting call to jffs2_kill_sb().

Signed-off-by: Artem B. Bityuckiy <dedekind@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
fs/jffs2/build.c
fs/jffs2/super.c

index 3dd5394921c9c6bb09a1dae11f87799f3c8be68f..97dc39796e2cc1f59aa4ad2edea8d275e93a4be3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: build.c,v 1.70 2005/02/28 08:21:05 dedekind Exp $
+ * $Id: build.c,v 1.71 2005/07/12 16:37:08 dedekind Exp $
  *
  */
 
@@ -336,13 +336,6 @@ int jffs2_do_mount_fs(struct jffs2_sb_info *c)
                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 2cf14cf8b35aacb82e26fc39486a9f485b442160..aaf9475cfb6ad866e05660121fd1a516650345b0 100644 (file)
@@ -7,7 +7,7 @@
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: super.c,v 1.106 2005/05/18 11:37:25 dedekind Exp $
+ * $Id: super.c,v 1.107 2005/07/12 16:37:08 dedekind Exp $
  *
  */
 
@@ -140,6 +140,15 @@ static struct super_block *jffs2_get_sb_mtd(struct file_system_type *fs_type,
        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;