Date: Tue, 14 Sep 2010 01:10:01 +0000 (UTC) From: Marcin Cieslak <saper@saper.info> To: freebsd-current@freebsd.org Subject: tun(4) in -CURRENT: No buffer space available - race condition patch Message-ID: <slrni8tir9.2b61.saper@saper.info> References: <slrnht8djj.1tsh.saper@saper.info>
next in thread | previous in thread | raw e-mail | index | archive | help
Output queue of tun(4) gets full after some time when sending lots of data.
I have been observing this on -CURRENT at least since March this year.
Looks like it's a race condition (same in tun(4) and tap(4)),
the following patch seems to address the issue:
Index: if_tap.c
===================================================================
--- if_tap.c (revision 212217)
+++ if_tap.c (working copy)
@@ -881,8 +881,7 @@
mtx_lock(&tp->tap_mtx);
tp->tap_flags |= TAP_RWAIT;
- mtx_unlock(&tp->tap_mtx);
- error = tsleep(tp,PCATCH|(PZERO+1),"taprd",0);
+ error = mtx_sleep(tp, &tp->tap_mtx, PDROP|PCATCH|(PZERO+1), "taprd", 0);
if (error)
return (error);
}
Index: if_tun.c
===================================================================
--- if_tun.c (revision 212217)
+++ if_tun.c (working copy)
@@ -836,8 +836,7 @@
}
mtx_lock(&tp->tun_mtx);
tp->tun_flags |= TUN_RWAIT;
- mtx_unlock(&tp->tun_mtx);
- if ((error = tsleep(tp, PCATCH | (PZERO + 1),
+ if ((error = mtx_sleep(tp, &tp->tun_mtx, PDROP | PCATCH | (PZERO + 1),
"tunread", 0)) != 0) {
splx(s);
return (error);
--Marcin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?slrni8tir9.2b61.saper>
