Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Thomas Gleixner <tglx@linutronix.de>

authored by

Thomas Gleixner and committed by
Thomas Gleixner
e2d48b1a fb4a90bf

+5 -2
+5 -2
fs/jffs2/background.c
··· 7 7 * 8 8 * For licensing information, see the file 'LICENCE' in this directory. 9 9 * 10 - * $Id: background.c,v 1.52 2005/05/19 16:18:08 gleixner Exp $ 10 + * $Id: background.c,v 1.54 2005/05/20 21:37:12 gleixner Exp $ 11 11 * 12 12 */ 13 13 ··· 56 56 57 57 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c) 58 58 { 59 + int wait = 0; 59 60 spin_lock(&c->erase_completion_lock); 60 61 if (c->gc_task) { 61 62 D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid)); 62 63 send_sig(SIGKILL, c->gc_task, 1); 64 + wait = 1; 63 65 } 64 66 spin_unlock(&c->erase_completion_lock); 65 - wait_for_completion(&c->gc_thread_exit); 67 + if (wait) 68 + wait_for_completion(&c->gc_thread_exit); 66 69 } 67 70 68 71 static int jffs2_garbage_collect_thread(void *_c)