Date: Mon, 24 Jan 2022 11:31:14 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 260116] [sctp] POLLOUT/EVFILT_WRITE is always true for poll/kqueue Message-ID: <bug-260116-227-lhPCCahAbe@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-260116-227@https.bugs.freebsd.org/bugzilla/> References: <bug-260116-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D260116 --- Comment #2 from Bj=C3=B6rn Svensson <bjorn.a.svensson@est.tech> --- 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: 4e88d37a2= a73 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 ins= tead 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#L39= 52 https://github.com/freebsd/freebsd-src/blob/main/sys/kern/uipc_socket.c#L36= 30 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 sendbu= ffer 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=20 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. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-260116-227-lhPCCahAbe>