Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109529100
D46850.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D46850.diff
View Options
diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -1567,49 +1567,46 @@
goto donenoprobe;
}
- if (tfo_cookie_valid) {
- bzero(&scs, sizeof(scs));
- sc = &scs;
- goto skip_alloc;
- }
-
+ KASSERT(sc == NULL, ("sc(%p) != NULL", sc));
/*
* Skip allocating a syncache entry if we are just going to discard
* it later.
*/
- if (!locked) {
+ if (!locked || tfo_cookie_valid) {
bzero(&scs, sizeof(scs));
sc = &scs;
- } else
- sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
- if (sc == NULL) {
- /*
- * The zone allocator couldn't provide more entries.
- * Treat this as if the cache was full; drop the oldest
- * entry and insert the new one.
- */
- TCPSTAT_INC(tcps_sc_zonefail);
- if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL) {
- sch->sch_last_overflow = time_uptime;
- syncache_drop(sc, sch);
- syncache_pause(inc);
- }
+ } else {
sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
if (sc == NULL) {
- if (V_tcp_syncookies) {
- bzero(&scs, sizeof(scs));
- sc = &scs;
- } else {
- KASSERT(locked,
- ("%s: bucket unexpectedly unlocked",
- __func__));
- SCH_UNLOCK(sch);
- goto done;
+ /*
+ * The zone allocator couldn't provide more entries.
+ * Treat this as if the cache was full; drop the oldest
+ * entry and insert the new one.
+ */
+ TCPSTAT_INC(tcps_sc_zonefail);
+ sc = TAILQ_LAST(&sch->sch_bucket, sch_head);
+ if (sc != NULL) {
+ sch->sch_last_overflow = time_uptime;
+ syncache_drop(sc, sch);
+ syncache_pause(inc);
+ }
+ sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
+ if (sc == NULL) {
+ if (V_tcp_syncookies) {
+ bzero(&scs, sizeof(scs));
+ sc = &scs;
+ } else {
+ KASSERT(locked,
+ ("%s: bucket unexpectedly unlocked",
+ __func__));
+ SCH_UNLOCK(sch);
+ goto done;
+ }
}
}
}
-skip_alloc:
+ KASSERT(sc != NULL, ("sc == NULL"));
if (!tfo_cookie_valid && tfo_response_cookie_valid)
sc->sc_tfo_cookie = &tfo_response_cookie;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Feb 7, 7:22 AM (21 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16507772
Default Alt Text
D46850.diff (2 KB)
Attached To
Mode
D46850: tcp: small cleanup
Attached
Detach File
Event Timeline
Log In to Comment