summary refs log tree commit diff
path: root/fs/jffs2/background.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-05-20 22:37:15 +0100
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 13:48:38 +0200
commite2d48b1a98bb5da8d6998ca4db0b20fa46938a11 (patch)
tree8b6cb220be02b78a064fa718bb2b5b182907bdf1 /fs/jffs2/background.c
parentfb4a90bfcd6d86e8531073c42fae7fde40974f5d (diff)
downloadlinux-e2d48b1a98bb5da8d6998ca4db0b20fa46938a11.tar.gz
[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>
Diffstat (limited to 'fs/jffs2/background.c')
-rw-r--r--fs/jffs2/background.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 5548749bacb6..65119d72cce0 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -7,7 +7,7 @@
  *
  * 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)
 
 void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
 {
+	int wait = 0;
 	spin_lock(&c->erase_completion_lock);
 	if (c->gc_task) {
 		D1(printk(KERN_DEBUG "jffs2: Killing GC task %d\n", c->gc_task->pid));
 		send_sig(SIGKILL, c->gc_task, 1);
+		wait = 1;
 	}
 	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)