diff mbox series

[2/2] cifs: add mount parameter tcpnodelay

Message ID 20211108144847.25163-3-tim.gardner@canonical.com
State New
Headers show
Series Two more CIFS backported patches | expand

Commit Message

Tim Gardner Nov. 8, 2021, 2:48 p.m. UTC
From: Steve French <stfrench@microsoft.com>

BugLink: https://bugs.launchpad.net/bugs/1947027

Although corking and uncorking the socket (which cifs.ko already
does) should usually have the desired benefit, using the new
tcpnodelay mount option causes tcp_sock_set_nodelay() to be set
on the socket which may be useful in order to ensure that we don't
ever have cases where the network stack is waiting on sending an
SMB request until multiple SMB requests have been added to the
send queue (since this could lead to long latencies).

To enable it simply append "tcpnodelay" it to the mount options

Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
(cherry picked from commit 7ae5e588b0a53a72819e661106cbe99dde83b41d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 fs/cifs/fs_context.c | 8 ++++++++
 fs/cifs/fs_context.h | 1 +
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 05aa0a238e99..e0a1f7dd7b5d 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -119,6 +119,7 @@  const struct fs_parameter_spec smb3_fs_parameters[] = {
 	fsparam_flag("nosharesock", Opt_nosharesock),
 	fsparam_flag_no("persistenthandles", Opt_persistent),
 	fsparam_flag_no("resilienthandles", Opt_resilient),
+	fsparam_flag_no("tcpnodelay", Opt_tcp_nodelay),
 	fsparam_flag("domainauto", Opt_domainauto),
 	fsparam_flag("rdma", Opt_rdma),
 	fsparam_flag("modesid", Opt_modesid),
@@ -1403,6 +1404,13 @@  static int smb3_fs_context_parse_param(struct fs_context *fc,
 			}
 		}
 		break;
+	case Opt_tcp_nodelay:
+		/* tcp nodelay should not usually be needed since we CORK/UNCORK the socket */
+		if (result.negated)
+			ctx->sockopt_tcp_nodelay = false;
+		else
+			ctx->sockopt_tcp_nodelay = true;
+		break;
 	case Opt_domainauto:
 		ctx->domainauto = true;
 		break;
diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h
index ac4b631d8ce3..f6f2cf0f5b45 100644
--- a/fs/cifs/fs_context.h
+++ b/fs/cifs/fs_context.h
@@ -101,6 +101,7 @@  enum cifs_param {
 	Opt_nosharesock,
 	Opt_persistent,
 	Opt_resilient,
+	Opt_tcp_nodelay,
 	Opt_domainauto,
 	Opt_rdma,
 	Opt_modesid,