[RFC PATCH 17/36] cifs: Don't use corking

From: David Howells

Date: Tue May 19 2026 - 06:30:15 EST


We don't need to cork the TCP socket if we send each message in a single
sendmsg() and set MSG_EOR to mark the last packet of the message with a
don't-append flag.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
cc: Steve French <sfrench@xxxxxxxxx>
cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
cc: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
cc: Tom Talpey <tom@xxxxxxxxxx>
cc: linux-cifs@xxxxxxxxxxxxxxx
cc: netfs@xxxxxxxxxxxxxxx
cc: linux-fsdevel@xxxxxxxxxxxxxxx
---
fs/smb/client/transport.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/fs/smb/client/transport.c b/fs/smb/client/transport.c
index 3ead26f76112..e43fce1099a9 100644
--- a/fs/smb/client/transport.c
+++ b/fs/smb/client/transport.c
@@ -271,9 +271,11 @@ static int smb_sendmsg(struct TCP_Server_Info *server, const struct iov_iter *it
struct msghdr msg = {
/*
* MSG_SPLICE_PAGES causes tcp_sendmsg() to splice in the pages
- * in the iterator rather than copying from them.
+ * in the iterator rather than copying from them; MSG_EOR
+ * indicates that the last TCP packet we create should be
+ * marked no-append with regards to the next sendmsg.
*/
- .msg_flags = MSG_NOSIGNAL | MSG_SPLICE_PAGES,
+ .msg_flags = MSG_NOSIGNAL | MSG_SPLICE_PAGES | MSG_EOR,
.msg_iter = *iter,
};
int retries = 0;
@@ -362,10 +364,6 @@ __smb_send_rqst(struct TCP_Server_Info *server, struct iov_iter *iter)
goto out;
}

- rc = 0;
- /* cork the socket */
- tcp_sock_set_cork(ssocket->sk, true);
-
/*
* We should not allow signals to interrupt the network send because
* any partial send will cause session reconnects thus increasing
@@ -381,9 +379,6 @@ __smb_send_rqst(struct TCP_Server_Info *server, struct iov_iter *iter)

sigprocmask(SIG_SETMASK, &oldmask, NULL);

- /* uncork it */
- tcp_sock_set_cork(ssocket->sk, false);
-
if (sent > 0) {
/*
* If signal is pending but we have already sent the whole