diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 3bbcaa716b3c..2e9e09ca0e30 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -98,7 +98,7 @@ struct smb_vol { | |||
98 | bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ | 98 | bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ |
99 | unsigned int rsize; | 99 | unsigned int rsize; |
100 | unsigned int wsize; | 100 | unsigned int wsize; |
101 | unsigned int sockopt; | 101 | bool sockopt_tcp_nodelay:1; |
102 | unsigned short int port; | 102 | unsigned short int port; |
103 | char *prepath; | 103 | char *prepath; |
104 | }; | 104 | }; |
@@ -1142,9 +1142,11 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1142 | simple_strtoul(value, &value, 0); | 1142 | simple_strtoul(value, &value, 0); |
1143 | } | 1143 | } |
1144 | } else if (strnicmp(data, "sockopt", 5) == 0) { | 1144 | } else if (strnicmp(data, "sockopt", 5) == 0) { |
1145 | if (value && *value) { | 1145 | if (!value || !*value) { |
1146 | vol->sockopt = | 1146 | cERROR(1, ("no socket option specified")); |
1147 | simple_strtoul(value, &value, 0); | 1147 | continue; |
1148 | } else if (strnicmp(value, "TCP_NODELAY", 11) == 0) { | ||
1149 | vol->sockopt_tcp_nodelay = 1; | ||
1148 | } | 1150 | } |
1149 | } else if (strnicmp(data, "netbiosname", 4) == 0) { | 1151 | } else if (strnicmp(data, "netbiosname", 4) == 0) { |
1150 | if (!value || !*value || (*value == ' ')) { | 1152 | if (!value || !*value || (*value == ' ')) { |
@@ -1514,6 +1516,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info) | |||
1514 | 1516 | ||
1515 | tcp_ses->noblocksnd = volume_info->noblocksnd; | 1517 | tcp_ses->noblocksnd = volume_info->noblocksnd; |
1516 | tcp_ses->noautotune = volume_info->noautotune; | 1518 | tcp_ses->noautotune = volume_info->noautotune; |
1519 | tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay; | ||
1517 | atomic_set(&tcp_ses->inFlight, 0); | 1520 | atomic_set(&tcp_ses->inFlight, 0); |
1518 | init_waitqueue_head(&tcp_ses->response_q); | 1521 | init_waitqueue_head(&tcp_ses->response_q); |
1519 | init_waitqueue_head(&tcp_ses->request_q); | 1522 | init_waitqueue_head(&tcp_ses->request_q); |
@@ -1764,6 +1767,7 @@ static int | |||
1764 | ipv4_connect(struct TCP_Server_Info *server) | 1767 | ipv4_connect(struct TCP_Server_Info *server) |
1765 | { | 1768 | { |
1766 | int rc = 0; | 1769 | int rc = 0; |
1770 | int val; | ||
1767 | bool connected = false; | 1771 | bool connected = false; |
1768 | __be16 orig_port = 0; | 1772 | __be16 orig_port = 0; |
1769 | struct socket *socket = server->ssocket; | 1773 | struct socket *socket = server->ssocket; |
@@ -1845,6 +1849,14 @@ ipv4_connect(struct TCP_Server_Info *server) | |||
1845 | socket->sk->sk_rcvbuf = 140 * 1024; | 1849 | socket->sk->sk_rcvbuf = 140 * 1024; |
1846 | } | 1850 | } |
1847 | 1851 | ||
1852 | if (server->tcp_nodelay) { | ||
1853 | val = 1; | ||
1854 | rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, | ||
1855 | (char *)&val, sizeof(val)); | ||
1856 | if (rc) | ||
1857 | cFYI(1, ("set TCP_NODELAY socket option error %d", rc)); | ||
1858 | } | ||
1859 | |||
1848 | cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx", | 1860 | cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx", |
1849 | socket->sk->sk_sndbuf, | 1861 | socket->sk->sk_sndbuf, |
1850 | socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo)); | 1862 | socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo)); |
@@ -1916,6 +1928,7 @@ static int | |||
1916 | ipv6_connect(struct TCP_Server_Info *server) | 1928 | ipv6_connect(struct TCP_Server_Info *server) |
1917 | { | 1929 | { |
1918 | int rc = 0; | 1930 | int rc = 0; |
1931 | int val; | ||
1919 | bool connected = false; | 1932 | bool connected = false; |
1920 | __be16 orig_port = 0; | 1933 | __be16 orig_port = 0; |
1921 | struct socket *socket = server->ssocket; | 1934 | struct socket *socket = server->ssocket; |
@@ -1987,6 +2000,15 @@ ipv6_connect(struct TCP_Server_Info *server) | |||
1987 | */ | 2000 | */ |
1988 | socket->sk->sk_rcvtimeo = 7 * HZ; | 2001 | socket->sk->sk_rcvtimeo = 7 * HZ; |
1989 | socket->sk->sk_sndtimeo = 5 * HZ; | 2002 | socket->sk->sk_sndtimeo = 5 * HZ; |
2003 | |||
2004 | if (server->tcp_nodelay) { | ||
2005 | val = 1; | ||
2006 | rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, | ||
2007 | (char *)&val, sizeof(val)); | ||
2008 | if (rc) | ||
2009 | cFYI(1, ("set TCP_NODELAY socket option error %d", rc)); | ||
2010 | } | ||
2011 | |||
1990 | server->ssocket = socket; | 2012 | server->ssocket = socket; |
1991 | 2013 | ||
1992 | return rc; | 2014 | return rc; |