Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Nov 2013 00:23:47 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r258611 - in projects/sv/sys: kern netinet
Message-ID:  <201311260023.rAQ0NlZk009491@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Nov 26 00:23:47 2013
New Revision: 258611
URL: http://svnweb.freebsd.org/changeset/base/258611

Log:
  Change the "netdump" DDB command to call doadump() when netdump is enabled,
  rather than calling netdumpsys() directly. Otherwise the context of the
  invoking thread is not saved in dumppcb and kgdb is unable to extract a
  backtrace for it.
  
  As a side effect, this change ensures that the kernel will attempt to dump
  core using netdump if a user runs the panic command from within DDB.
  Previously, this would simply result in a reboot if a dump device had not
  been configured (which is generally the case when netdump is enabled).
  
  Reviewed by:	rstone
  Sponsored by:	Sandvine Inc.

Modified:
  projects/sv/sys/kern/kern_shutdown.c
  projects/sv/sys/netinet/netdump.h
  projects/sv/sys/netinet/netdump_client.c

Modified: projects/sv/sys/kern/kern_shutdown.c
==============================================================================
--- projects/sv/sys/kern/kern_shutdown.c	Mon Nov 25 23:45:50 2013	(r258610)
+++ projects/sv/sys/kern/kern_shutdown.c	Tue Nov 26 00:23:47 2013	(r258611)
@@ -251,17 +251,11 @@ doadump(void)
 	/*
 	 * If netdump finished successfully just return, otherwise give
 	 * traditional disk dumping a chance.
-	 *
-	 * Avoid a POLA breakage by skipping netdump when calling it from
-	 * within KDB.  That may change in the future.
 	 */
-#ifdef KDB
-	if (kdb_why == KDB_WHY_UNSET)
-#endif
-		if (netdumpsys() == 0) {
-			dumping--;
-			return;
-		}
+	if (netdumpsys() == 0) {
+		dumping--;
+		return;
+	}
 #endif
 
 	/*
@@ -620,6 +614,17 @@ panic(const char *fmt, ...)
 	kern_reboot(bootopt);
 }
 
+#ifdef DDB
+DB_COMMAND(netdump, ddb_force_netdump)
+{
+
+	if (nd_enable)
+		netdumpsys();
+	else
+		db_printf("netdump is not enabled\n");
+}
+#endif
+
 /*
  * Support for poweroff delay.
  *

Modified: projects/sv/sys/netinet/netdump.h
==============================================================================
--- projects/sv/sys/netinet/netdump.h	Mon Nov 25 23:45:50 2013	(r258610)
+++ projects/sv/sys/netinet/netdump.h	Tue Nov 26 00:23:47 2013	(r258611)
@@ -72,6 +72,8 @@ struct netdump_methods {
 
 int	 netdumpsys(void);
 
+extern int nd_enable;
+
 #endif
 
 #endif /* !_NETINET_NETDUMP_H_ */

Modified: projects/sv/sys/netinet/netdump_client.c
==============================================================================
--- projects/sv/sys/netinet/netdump_client.c	Mon Nov 25 23:45:50 2013	(r258610)
+++ projects/sv/sys/netinet/netdump_client.c	Tue Nov 26 00:23:47 2013	(r258611)
@@ -137,7 +137,7 @@ static struct in_addr nd_server = {INADD
 static struct in_addr nd_client = {INADDR_ANY};
 static struct in_addr nd_gw = {INADDR_ANY};
 struct ifnet *nd_ifp;
-static int nd_enable = 0;
+int nd_enable = 0;
 static uint16_t nd_server_port = NETDUMP_PORT;
 
 /* Tunables storages. */
@@ -1198,11 +1198,3 @@ netdump_config_defaults(void *dummy __un
 	}
 }
 SYSINIT(netdump, SI_SUB_KLD, SI_ORDER_ANY, netdump_config_defaults, NULL);
-
-#ifdef DDB
-DB_COMMAND(netdump, ddb_force_netdump)
-{
-
-	netdumpsys();
-}
-#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311260023.rAQ0NlZk009491>