kernel panic in -stable

Matthew Dillon dillon at apollo.backplane.com
Wed Dec 29 19:17:16 PST 2004


    Ok, try this patch.

    Theoretically the trigger for your bug is when you disconnect an
    smb session, then do a 'ps' (or anything does a 'ps' equivalent,
    in the case of the crash a KDE daemon was doing it).  See if you
    can reproduce the bug without the patch and then see if the patch
    fixes it.  It may be hard to reproduce but since it was totally
    broken before I'll commit the patch anyway (unless the patch causes
    an instant panic that is :-)).

					-Matt

Index: smb_iod.c
===================================================================
RCS file: /cvs/src/sys/netproto/smb/smb_iod.c,v
retrieving revision 1.10
diff -u -r1.10 smb_iod.c
--- smb_iod.c	21 Jun 2004 05:31:47 -0000	1.10
+++ smb_iod.c	30 Dec 2004 03:07:24 -0000
@@ -648,7 +648,7 @@
 }
 
 #define	kthread_create_compat	kthread_create2
-
+#define kthread_exit_compat	kthread_exit2
 
 void
 smb_iod_thread(void *arg)
@@ -663,7 +663,7 @@
 			break;
 		tsleep(&iod->iod_flags, 0, "90idle", iod->iod_sleeptimo);
 	}
-	kthread_exit();
+	kthread_exit_compat();
 }
 
 int
Index: smb_subr.c
===================================================================
RCS file: /cvs/src/sys/netproto/smb/smb_subr.c,v
retrieving revision 1.12
diff -u -r1.12 smb_subr.c
--- smb_subr.c	20 Jun 2004 22:29:10 -0000	1.12
+++ smb_subr.c	30 Dec 2004 03:09:46 -0000
@@ -361,6 +361,9 @@
 /*
  * Create a kernel process/thread/whatever.  It shares it's address space
  * with proc0 - ie: kernel only.
+ *
+ * XXX only the SMB protocol uses this, we should convert this mess to a
+ * pure thread when possible.
  */
 int
 kthread_create2(void (*func)(void *), void *arg,
@@ -399,6 +402,12 @@
 	return 0;
 }
 
+void
+kthread_exit2(void)
+{
+	exit1(0);
+}
+
 /*
  * smb_sleep() icky compat routine.  Leave the token held through the tsleep
  * to interlock against the sleep.  Remember that the token could be lost
Index: smb_subr.h
===================================================================
RCS file: /cvs/src/sys/netproto/smb/smb_subr.h,v
retrieving revision 1.9
diff -u -r1.9 smb_subr.h
--- smb_subr.h	19 Mar 2004 17:06:08 -0000	1.9
+++ smb_subr.h	30 Dec 2004 03:08:17 -0000
@@ -172,6 +172,7 @@
  */
 int kthread_create2(void (*func)(void *), void *arg,
     struct proc **newpp, int flags, const char *fmt, ...);
+void kthread_exit2(void);
 int smb_sleep(void *chan, struct lwkt_tokref *ilock, int slpflags, const char *wmesg, int timo);
 
 





More information about the Bugs mailing list