Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Nov 2018 05:24:20 +0000 (UTC)
From:      Conrad Meyer <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r340358 - head/sys/kern
Message-ID:  <201811120524.wAC5OKnH080464@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



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