aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2001-01-25 19:48:57 +0000
committerJulian Elischer <julian@FreeBSD.org>2001-01-25 19:48:57 +0000
commit34f9ca09081cf88a817389e0d4f939067f37ab3d (patch)
tree09e4d82ae4d7011477646fee4d38b0444bc7c68f
parentb00df9c9ba96a8857476e2f342dde76f595a6f8d (diff)
downloadsrc-34f9ca09081cf88a817389e0d4f939067f37ab3d.tar.gz
src-34f9ca09081cf88a817389e0d4f939067f37ab3d.zip
Only clear the 'free' bit if we were successful in getting a queue item off the free list.
Found by: Harti Brandt (address unknown)
Notes
Notes: svn path=/head/; revision=71650
-rw-r--r--sys/netgraph/ng_base.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c
index 78b4aaa59bf9..d7370eb82ad2 100644
--- a/sys/netgraph/ng_base.c
+++ b/sys/netgraph/ng_base.c
@@ -3027,7 +3027,7 @@ ng_getqblk(void)
* ngqfree is the final arbiter. We have our little reserve
* because we use M_NOWAIT for malloc. This just helps us
* avoid dropping packets while not increasing the time
- * we take to service the interrupt (on average) (we hope).
+ * we take to service the interrupt (on average) (I hope).
*/
for (;;) {
if ((ngqfreesize < ngqfreelow) || (ngqfree == NULL)) {
@@ -3062,15 +3062,19 @@ ng_getqblk(void)
*/
if (atomic_cmpset_ptr(&ngqfree, item, item->el_next)) {
atomic_subtract_int(&ngqfreesize, 1);
+ item->el_flags &= ~NGQF_FREE;
break;
}
+ /*
+ * something got there before we did.. try again
+ * (go around the loop again)
+ */
item = NULL;
} else {
/* We really ran out */
break;
}
}
- item->el_flags &= ~NGQF_FREE;
return (item);
}