Page MenuHomeFreeBSD

sendfile: retire M_BLOCKED
ClosedPublic

Authored by glebius on Jun 6 2025, 5:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 3, 2:05 AM
Unknown Object (File)
Mon, Nov 3, 2:04 AM
Unknown Object (File)
Mon, Nov 3, 2:04 AM
Unknown Object (File)
Mon, Nov 3, 2:04 AM
Unknown Object (File)
Sat, Nov 1, 7:44 PM
Unknown Object (File)
Oct 28 2025, 2:36 AM
Unknown Object (File)
Oct 21 2025, 10:39 PM
Unknown Object (File)
Oct 4 2025, 3:52 AM
Subscribers

Details

Summary

Follow unix(4) commit 51ac5ee0d57f and retire M_BLOCKED for TCP sockets as
well. The M_BLOCKED flag was introduced back 2016 together with non-
blocking sendfile(2). It marked mbufs in a sending socket buffer that
could be ready to sent, but are sitting behind an M_NOTREADY mbuf(s), that
blocks them.

You may consider this flag as an INVARIANT flag that helped to ensure
socket buffer consistency. Or maybe the socket code was so convoluted
back then, that it was unclear if sbfree() may be called on an mbuf that
is in the middle of the buffer, and I decided to introduce the flag to
protect against that. With today state of socket buffer code it became
clear that the latter cannot happen. And this commit adds an assertion
proving that.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable