Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F142233583
D29544.id86728.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D29544.id86728.diff
View Options
Index: sys/kern/subr_sbuf.c
===================================================================
--- sys/kern/subr_sbuf.c
+++ sys/kern/subr_sbuf.c
@@ -388,8 +388,12 @@
{
int len;
- KASSERT(s->s_len > 0, ("Shouldn't drain empty sbuf %p", s));
- KASSERT(s->s_error == 0, ("Called %s with error on %p", __func__, s));
+ /*
+ * Immediately return when no work to do,
+ * or an error has already been accumulated.
+ */
+ if ((s->s_len == 0) || (s->s_error != 0))
+ return(s->s_error);
if (SBUF_DODRAINTOEOR(s) && s->s_rec_off == 0)
return (s->s_error = EDEADLK);
Index: sys/netinet/tcp_hostcache.c
===================================================================
--- sys/netinet/tcp_hostcache.c
+++ sys/netinet/tcp_hostcache.c
@@ -644,7 +644,6 @@
const int linesize = 128;
struct sbuf sb;
int i, error, len;
- bool do_drain = false;
struct hc_metrics *hc_entry;
char ip4buf[INET_ADDRSTRLEN];
#ifdef INET6
@@ -702,16 +701,12 @@
hc_entry->rmx_hits,
hc_entry->rmx_updates,
hc_entry->rmx_expire);
- do_drain = true;
}
THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);
/* Need to track if sbuf has data, to avoid
* a KASSERT when calling sbuf_drain.
*/
- if (do_drain) {
- sbuf_drain(&sb);
- do_drain = false;
- }
+ sbuf_drain(&sb);
}
#undef msec
error = sbuf_finish(&sb);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 18, 3:09 PM (2 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27710918
Default Alt Text
D29544.id86728.diff (1 KB)
Attached To
Mode
D29544: Make sbuf_drain safe for external use
Attached
Detach File
Event Timeline
Log In to Comment