X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fjffs2%2Fbackground.c;h=3cceef4ad2b7df413e98b8171cadf074de83ad2d;hb=2e93960c4d712096902c16fe5511fc91502c2527;hp=8adebd3e43c690fbf0469cf9b235279998c252c8;hpb=c1f3ee120bb61045b1c0a3ead620d1d65af47130;p=linux-2.6-omap-h63xx.git diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c index 8adebd3e43c..3cceef4ad2b 100644 --- a/fs/jffs2/background.c +++ b/fs/jffs2/background.c @@ -85,15 +85,15 @@ static int jffs2_garbage_collect_thread(void *_c) for (;;) { allow_signal(SIGHUP); again: + spin_lock(&c->erase_completion_lock); if (!jffs2_thread_should_wake(c)) { set_current_state (TASK_INTERRUPTIBLE); + spin_unlock(&c->erase_completion_lock); D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n")); - /* Yes, there's a race here; we checked jffs2_thread_should_wake() - before setting current->state to TASK_INTERRUPTIBLE. But it doesn't - matter - We don't care if we miss a wakeup, because the GC thread - is only an optimisation anyway. */ schedule(); - } + } else + spin_unlock(&c->erase_completion_lock); + /* This thread is purely an optimisation. But if it runs when other things could be running, it actually makes things a