Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: Give client EOF when we are done writing
If we detect a fatal error but do not close the socket back to the client, then we can create deadlock where we are stuck waiting to read NBD_CMD_DISC from the client but where the client is stuck waiting to read our reply. Try harder to explicitly inform the client any time that we have detected when our connection has degraded enough to warrant that we won't do any more writing, even if we still hang on to the socket for a bit longer for further reads. State-wise, all clients will exit through one of two paths: normal -> conn->close(SHUT_WR) -> conn->close(SHUT_RDWR) normal -> conn->close(SHUT_RDWR) That is, SHUT_WR is an optional state which exists to help avoid deadlocks, but which does not cause an fd leak of sockin because we will always reach SHUT_RDWR. Message-Id: <20221026221802.207215-3-eblake@redhat.com> (cherry picked from commit bf8653b)
- Loading branch information
Showing
3 changed files
with
34 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters