public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: test11-pre6
Date: Fri, 17 Nov 2000 10:37:35 +0000	[thread overview]
Message-ID: <8004.974457455@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.10.10011161832460.803-100000@penguin.transmeta.com>
In-Reply-To: <Pine.LNX.4.10.10011161832460.803-100000@penguin.transmeta.com>


Missing up_and_exit() which is required for killing kernel threads on 
cleanup_module(). 

This patch also fixes JFFS and USB hub.c to use it. 

Index: include/linux/kernel.h
===================================================================
RCS file: /inst/cvs/linux/include/linux/kernel.h,v
retrieving revision 1.1.1.1.2.11
diff -u -r1.1.1.1.2.11 kernel.h
--- include/linux/kernel.h	2000/09/26 18:57:59	1.1.1.1.2.11
+++ include/linux/kernel.h	2000/11/17 10:30:05
@@ -45,10 +45,14 @@
 #define FASTCALL(x)	x
 #endif
 
+struct semaphore;
+
 extern struct notifier_block *panic_notifier_list;
 NORET_TYPE void panic(const char * fmt, ...)
 	__attribute__ ((NORET_AND format (printf, 1, 2)));
 NORET_TYPE void do_exit(long error_code)
+	ATTRIB_NORET;
+NORET_TYPE void up_and_exit(struct semaphore *, long)
 	ATTRIB_NORET;
 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
 extern long simple_strtol(const char *,char **,unsigned int);
Index: kernel/exit.c
===================================================================
RCS file: /inst/cvs/linux/kernel/exit.c,v
retrieving revision 1.3.2.29
diff -u -r1.3.2.29 exit.c
--- kernel/exit.c	2000/09/18 13:54:01	1.3.2.29
+++ kernel/exit.c	2000/11/17 10:30:05
@@ -467,6 +467,14 @@
 	goto fake_volatile;
 }
 
+NORET_TYPE void up_and_exit(struct semaphore *sem, long code)
+{
+	if (sem)
+		up(sem);
+	
+	do_exit(code);
+}
+
 asmlinkage long sys_exit(int error_code)
 {
 	do_exit((error_code&0xff)<<8);
Index: kernel/ksyms.c
===================================================================
RCS file: /inst/cvs/linux/kernel/ksyms.c,v
retrieving revision 1.3.2.66
diff -u -r1.3.2.66 ksyms.c
--- kernel/ksyms.c	2000/11/17 09:35:53	1.3.2.66
+++ kernel/ksyms.c	2000/11/17 10:30:05
@@ -418,6 +418,7 @@
 EXPORT_SYMBOL(iomem_resource);
 
 /* process management */
+EXPORT_SYMBOL(up_and_exit);
 EXPORT_SYMBOL(__wake_up);
 EXPORT_SYMBOL(wake_up_process);
 EXPORT_SYMBOL(sleep_on);
Index: drivers/usb/hub.c
===================================================================
RCS file: /inst/cvs/linux/drivers/usb/hub.c,v
retrieving revision 1.2.2.41
diff -u -r1.2.2.41 hub.c
--- drivers/usb/hub.c	2000/11/13 11:00:15	1.2.2.41
+++ drivers/usb/hub.c	2000/11/17 10:30:05
@@ -36,7 +36,7 @@
 
 static DECLARE_WAIT_QUEUE_HEAD(khubd_wait);
 static int khubd_pid = 0;			/* PID of khubd */
-static int khubd_running = 0;
+static DECLARE_MUTEX_LOCKED(khubd_exited);
 
 static int usb_get_hub_descriptor(struct usb_device *dev, void *data, int size)
 {
@@ -741,8 +741,6 @@
 
 static int usb_hub_thread(void *__hub)
 {
-	khubd_running = 1;
-
 	lock_kernel();
 
 	/*
@@ -762,9 +760,8 @@
 	} while (!signal_pending(current));
 
 	dbg("usb_hub_thread exiting");
-	khubd_running = 0;
 
-	return 0;
+	up_and_exit(&khubd_exited, 0);
 }
 
 static struct usb_device_id hub_id_table [] = {
@@ -815,18 +812,8 @@
 
 	/* Kill the thread */
 	ret = kill_proc(khubd_pid, SIGTERM, 1);
-	if (!ret) {
-		/* Wait 10 seconds */
-		int count = 10 * 100;
 
-		while (khubd_running && --count) {
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(1);
-		}
-
-		if (!count)
-			err("giving up on killing khubd");
-	}
+	down(&khubd_exited);
 
 	/*
 	 * Hub resources are freed for us by usb_deregister. It calls
Index: fs/jffs/intrep.c
===================================================================
RCS file: /inst/cvs/linux/fs/jffs/Attic/intrep.c,v
retrieving revision 1.1.2.5
diff -u -r1.1.2.5 intrep.c
--- fs/jffs/intrep.c	2000/11/15 12:15:06	1.1.2.5
+++ fs/jffs/intrep.c	2000/11/17 10:30:05
@@ -3054,9 +3054,8 @@
 			case SIGKILL:
 				D1(printk("jffs_garbage_collect_thread(): SIGKILL received.\n"));
 				c->gc_task = NULL;
-				up(&c->gc_thread_sem);
 				unlock_kernel();
-				return(0);
+				up_and_exit(&c->gc_thread_sem, 0);
 			}
 		}
 


--
dwmw2


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

  parent reply	other threads:[~2000-11-17 11:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-11-17  2:33 test11-pre6 Linus Torvalds
2000-11-17  3:45 ` test11-pre6 Jeff V. Merkey
2000-11-17  7:30   ` test11-pre6 Erik Andersen
2000-11-17  8:30     ` test11-pre6 David Lang
2000-11-17  8:53     ` test11-pre6 Jeff V. Merkey
2000-11-17 16:11     ` test11-pre6 Mike A. Harris
2000-11-17  7:33 ` test11-pre6 Chris Wedgwood
2000-11-17 11:57   ` test11-pre6 Jeff Garzik
2000-11-17  9:06 ` [PATCH-2.4.0-10] vgacon.c jani
2000-11-17 10:37 ` David Woodhouse [this message]
2000-11-17 11:51 ` [patch] hotplug fixes Re: test11-pre6 Tigran Aivazian
  -- strict thread matches above, loose matches on Subject: below --
2000-11-17  3:02 test11-pre6 Ying Chen/Almaden/IBM
2000-11-17  3:09 ` test11-pre6 David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8004.974457455@redhat.com \
    --to=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox