]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
jffs2: Require jffs2_garbage_collect_trigger() to be called with lock held
authorDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 19 May 2010 16:00:10 +0000 (17:00 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 19 May 2010 16:10:22 +0000 (17:10 +0100)
We're about to call this from a bunch of places which already hold
c->erase_completion_lock, so add an assertion and change its existing
callers to do the same.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
fs/jffs2/background.c
fs/jffs2/nodemgmt.c
fs/jffs2/super.c

index 3ff50da94789111a4707082eefb4289c377e1a51..55f1dde2fa8b01ebd9b95266f9457d0b2bd9bb94 100644 (file)
@@ -23,10 +23,9 @@ static int jffs2_garbage_collect_thread(void *);
 
 void jffs2_garbage_collect_trigger(struct jffs2_sb_info *c)
 {
-       spin_lock(&c->erase_completion_lock);
+       assert_spin_locked(&c->erase_completion_lock);
        if (c->gc_task && jffs2_thread_should_wake(c))
                send_sig(SIGHUP, c->gc_task, 1);
-       spin_unlock(&c->erase_completion_lock);
 }
 
 /* This must only ever be called when no GC thread is currently running */
index 5ab5c8521cdf9576b308ba7237015438a82a9887..dd2d920d3325d2daabd76265f826542a2cdf1edd 100644 (file)
@@ -481,7 +481,9 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
 void jffs2_complete_reservation(struct jffs2_sb_info *c)
 {
        D1(printk(KERN_DEBUG "jffs2_complete_reservation()\n"));
+       spin_lock(&c->erase_completion_lock);
        jffs2_garbage_collect_trigger(c);
+       spin_unlock(&c->erase_completion_lock);
        mutex_unlock(&c->alloc_sem);
 }
 
index 9a80e8e595d0d462aa38b2d47aee57f0ea10a07e..12cc967c5c032935f8413aa396d26e8630eb7cc8 100644 (file)
@@ -63,7 +63,9 @@ static void jffs2_write_super(struct super_block *sb)
 
        if (!(sb->s_flags & MS_RDONLY)) {
                D1(printk(KERN_DEBUG "jffs2_write_super()\n"));
+               spin_lock(&c->erase_completion_lock);
                jffs2_garbage_collect_trigger(c);
+               spin_unlock(&c->erase_completion_lock);
                jffs2_erase_pending_blocks(c, 0);
                jffs2_flush_wbuf_gc(c, 0);
        }