Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F112558121
D49363.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
D49363.diff
View Options
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -75,7 +75,6 @@
struct mbuf *n);
#endif
static struct mbuf *sbcut_internal(struct sockbuf *sb, int len);
-static void sbflush_internal(struct sockbuf *sb);
/*
* Our own version of m_clrprotoflags(), that can preserve M_NOTREADY.
@@ -779,24 +778,17 @@
/*
* Free mbufs held by a socket, and reserved mbuf space.
*/
-static void
-sbrelease_internal(struct socket *so, sb_which which)
-{
- struct sockbuf *sb = sobuf(so, which);
-
- sbflush_internal(sb);
- (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0,
- RLIM_INFINITY);
- sb->sb_mbmax = 0;
-}
-
void
sbrelease_locked(struct socket *so, sb_which which)
{
+ struct sockbuf *sb = sobuf(so, which);
SOCK_BUF_LOCK_ASSERT(so, which);
- sbrelease_internal(so, which);
+ sbflush_locked(sb);
+ (void)chgsbsize(so->so_cred->cr_uidinfo, &sb->sb_hiwat, 0,
+ RLIM_INFINITY);
+ sb->sb_mbmax = 0;
}
void
@@ -818,7 +810,7 @@
ktls_free(sb->sb_tls_info);
sb->sb_tls_info = NULL;
#endif
- sbrelease_internal(so, which);
+ sbrelease_locked(so, which);
}
/*
@@ -1530,10 +1522,12 @@
/*
* Free all mbufs in a sockbuf. Check that all resources are reclaimed.
*/
-static void
-sbflush_internal(struct sockbuf *sb)
+void
+sbflush_locked(struct sockbuf *sb)
{
+ SOCKBUF_LOCK_ASSERT(sb);
+
while (sb->sb_mbcnt || sb->sb_tlsdcc) {
/*
* Don't call sbcut(sb, 0) if the leading mbuf is non-empty:
@@ -1548,14 +1542,6 @@
sb->sb_ccc, (void *)sb->sb_mb, sb->sb_mbcnt));
}
-void
-sbflush_locked(struct sockbuf *sb)
-{
-
- SOCKBUF_LOCK_ASSERT(sb);
- sbflush_internal(sb);
-}
-
void
sbflush(struct sockbuf *sb)
{
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1866,14 +1866,22 @@
if (pr->pr_detach != NULL)
pr->pr_detach(so);
- /*
- * From this point on, we assume that no other references to this
- * socket exist anywhere else in the stack. Therefore, no locks need
- * to be acquired or held.
- */
if (!(pr->pr_flags & PR_SOCKBUF) && !SOLISTENING(so)) {
+ /*
+ * From this point on, we assume that no other references to
+ * this socket exist anywhere else in the stack. Therefore,
+ * no locks need to be acquired or held.
+ */
+#ifdef INVARIANTS
+ SOCK_SENDBUF_LOCK(so);
+ SOCK_RECVBUF_LOCK(so);
+#endif
sbdestroy(so, SO_SND);
sbdestroy(so, SO_RCV);
+#ifdef INVARIANTS
+ SOCK_SENDBUF_UNLOCK(so);
+ SOCK_RECVBUF_UNLOCK(so);
+#endif
}
seldrain(&so->so_rdsel);
seldrain(&so->so_wrsel);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 8:00 PM (15 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17234126
Default Alt Text
D49363.diff (2 KB)
Attached To
Mode
D49363: sockbuf: remove sbflush_internal() and sbrelease_internal() shims
Attached
Detach File
Event Timeline
Log In to Comment