Date: Mon, 24 Jan 2022 11:31:14 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260116 --- Comment #2 from Björn Svensson <firstname.lastname@example.org> --- After some investigations we have seen that the introduction of "sendfile(2) system call' required some changes in the struct sockbuf. The field sb_cc was split into sb_ccc and sb_acc in commit: 0f9d0a73a495 For SCTP a macro was introduced to handle this change via commit: 4e88d37a2a73 The change of using sb_ccc instead of sb_cc unfortunately seemed to trigger problems with SCTP sockets and select() so it was changed to use sb_acc instead via commit: 975c975bf0f1 The problem we now see is that when POLLOUT/EVFILT_WRITE are handled in sopoll_generic() and filt_sowrite() they call sbspace(): https://github.com/freebsd/freebsd-src/blob/main/sys/kern/uipc_socket.c#L3952 https://github.com/freebsd/freebsd-src/blob/main/sys/kern/uipc_socket.c#L3630 https://github.com/freebsd/freebsd-src/blob/main/sys/sys/socketvar.h#L325 but sbspace() still uses sb->sb_ccc when calculating the space. https://github.com/freebsd/freebsd-src/blob/main/sys/sys/sockbuf.h#L239 This results in that the socket always seems writeable even when the sendbuffer is full. Some ideas to solve this would be to: - Change sbspace() to use sb_acc when sb_ccc is zero. * This might be a bit hacky * This might affect other users of the function. - Update both sb_acc and sb_ccc in SCTP Since SCTP already updates sb_acc to fit into the framework we can double book the value to sb_ccc as well. The sb_acc field should be the owner of the information, but when changed it's copied to sb_ccc. * This only affects the SCTP code Any thoughts or other ideas? I will create a patchset for updating both sb_ccc and sb_acc and test this idea. -- You are receiving this mail because: You are the assignee for the bug.