svn commit: r340358 - head/sys/kern

Conrad Meyer cem at FreeBSD.org
Mon Nov 12 05:24:21 UTC 2018


Author: cem
Date: Mon Nov 12 05:24:20 2018
New Revision: 340358
URL: https://svnweb.freebsd.org/changeset/base/340358

Log:
  netdump: Fix netdumping with INVARIANTS kernels
  
  Correct boneheaded assertion I added in r339501.  Mea culpa.
  
  The intent is to notice when an M_WAITOK zone allocation would fail during
  netdump, not to prevent all use of mbufs during netdump.
  
  Reviewed by:	markj
  X-MFC-With:	r339501
  Differential Revision:	https://reviews.freebsd.org/D17957

Modified:
  head/sys/kern/kern_mbuf.c

Modified: head/sys/kern/kern_mbuf.c
==============================================================================
--- head/sys/kern/kern_mbuf.c	Mon Nov 12 00:42:34 2018	(r340357)
+++ head/sys/kern/kern_mbuf.c	Mon Nov 12 05:24:20 2018	(r340358)
@@ -410,8 +410,6 @@ nd_buf_import(void *arg, void **store, int count, int 
 	struct mbuf *m;
 	int i;
 
-	KASSERT(!dumping, ("%s: ran out of pre-allocated mbufs", __func__));
-
 	q = arg;
 
 	for (i = 0; i < count; i++) {
@@ -421,6 +419,8 @@ nd_buf_import(void *arg, void **store, int count, int 
 		trash_init(m, q == &nd_mbufq ? MSIZE : nd_clsize, flags);
 		store[i] = m;
 	}
+	KASSERT((flags & M_WAITOK) == 0 || i == count,
+	    ("%s: ran out of pre-allocated mbufs", __func__));
 	return (i);
 }
 
@@ -447,8 +447,6 @@ nd_pack_import(void *arg __unused, void **store, int c
 	void *clust;
 	int i;
 
-	KASSERT(!dumping, ("%s: ran out of pre-allocated mbufs", __func__));
-
 	for (i = 0; i < count; i++) {
 		m = m_get(MT_DATA, M_NOWAIT);
 		if (m == NULL)
@@ -461,6 +459,8 @@ nd_pack_import(void *arg __unused, void **store, int c
 		mb_ctor_clust(clust, nd_clsize, m, 0);
 		store[i] = m;
 	}
+	KASSERT((flags & M_WAITOK) == 0 || i == count,
+	    ("%s: ran out of pre-allocated mbufs", __func__));
 	return (i);
 }
 


More information about the svn-src-all mailing list