Commit e2d48b1a authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Thomas Gleixner

[JFFS2] Fix cleanup in case of GC-Task not started

Do not call wait_for_completion, when the gc task is not there. 
Prevent an oops when the gc thread was not started.
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent fb4a90bf
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* For licensing information, see the file 'LICENCE' in this directory. * For licensing information, see the file 'LICENCE' in this directory.
* *
* $Id: background.c,v 1.52 2005/05/19 16:18:08 gleixner Exp $ * $Id: background.c,v 1.54 2005/05/20 21:37:12 gleixner Exp $
* *
*/ */
...@@ -56,13 +56,16 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) ...@@ -56,13 +56,16 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
{ {
int wait = 0;
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
if (c->gc_task) { if (c->gc_task) {
D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid)); D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));
send_sig(SIGKILL, c->gc_task, 1); send_sig(SIGKILL, c->gc_task, 1);
wait = 1;
} }
spin_unlock(&c->erase_completion_lock); spin_unlock(&c->erase_completion_lock);
wait_for_completion(&c->gc_thread_exit); if (wait)
wait_for_completion(&c->gc_thread_exit);
} }
static int jffs2_garbage_collect_thread(void *_c) static int jffs2_garbage_collect_thread(void *_c)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment