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

David Howells <[email protected]> Tue, 19 May 2026 11:21:35 +0100
Newsgroups dev.linux.lists.netfs,org.kernel.vger.linux-cifs,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
cc: Steve French <[email protected]>
cc: Paulo Alcantara <[email protected]>
cc: Shyam Prasad N <[email protected]>
cc: Tom Talpey <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
---
 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