Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
cifs: fix dentry hash calculation for case-insensitive mounts
[CIFS] Don't cache timestamps on utimes due to coarse granularity
[CIFS] Maximum username length check in session setup does not match
cifs: fix length calculation for converted unicode readdir names
[CIFS] Add support for TCP_NODELAY

+54 -14
+4
fs/cifs/CHANGES
··· 1 + Version 1.62 2 + ------------ 3 + Add sockopt=TCP_NODELAY mount option. 4 + 1 5 Version 1.61 2 6 ------------ 3 7 Fix append problem to Samba servers (files opened with O_APPEND could
+1 -1
fs/cifs/cifsfs.h
··· 113 113 extern const struct export_operations cifs_export_ops; 114 114 #endif /* EXPERIMENTAL */ 115 115 116 - #define CIFS_VERSION "1.61" 116 + #define CIFS_VERSION "1.62" 117 117 #endif /* _CIFSFS_H */
+1
fs/cifs/cifsglob.h
··· 149 149 bool svlocal:1; /* local server or remote */ 150 150 bool noblocksnd; /* use blocking sendmsg */ 151 151 bool noautotune; /* do not autotune send buf sizes */ 152 + bool tcp_nodelay; 152 153 atomic_t inFlight; /* number of requests on the wire to server */ 153 154 #ifdef CONFIG_CIFS_STATS2 154 155 atomic_t inSend; /* requests trying to send */
+26 -4
fs/cifs/connect.c
··· 98 98 bool nostrictsync:1; /* do not force expensive SMBflush on every sync */ 99 99 unsigned int rsize; 100 100 unsigned int wsize; 101 - unsigned int sockopt; 101 + bool sockopt_tcp_nodelay:1; 102 102 unsigned short int port; 103 103 char *prepath; 104 104 }; ··· 1142 1142 simple_strtoul(value, &value, 0); 1143 1143 } 1144 1144 } else if (strnicmp(data, "sockopt", 5) == 0) { 1145 - if (value && *value) { 1146 - vol->sockopt = 1147 - simple_strtoul(value, &value, 0); 1145 + if (!value || !*value) { 1146 + cERROR(1, ("no socket option specified")); 1147 + continue; 1148 + } else if (strnicmp(value, "TCP_NODELAY", 11) == 0) { 1149 + vol->sockopt_tcp_nodelay = 1; 1148 1150 } 1149 1151 } else if (strnicmp(data, "netbiosname", 4) == 0) { 1150 1152 if (!value || !*value || (*value == ' ')) { ··· 1516 1514 1517 1515 tcp_ses->noblocksnd = volume_info->noblocksnd; 1518 1516 tcp_ses->noautotune = volume_info->noautotune; 1517 + tcp_ses->tcp_nodelay = volume_info->sockopt_tcp_nodelay; 1519 1518 atomic_set(&tcp_ses->inFlight, 0); 1520 1519 init_waitqueue_head(&tcp_ses->response_q); 1521 1520 init_waitqueue_head(&tcp_ses->request_q); ··· 1767 1764 ipv4_connect(struct TCP_Server_Info *server) 1768 1765 { 1769 1766 int rc = 0; 1767 + int val; 1770 1768 bool connected = false; 1771 1769 __be16 orig_port = 0; 1772 1770 struct socket *socket = server->ssocket; ··· 1849 1845 socket->sk->sk_rcvbuf = 140 * 1024; 1850 1846 } 1851 1847 1848 + if (server->tcp_nodelay) { 1849 + val = 1; 1850 + rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, 1851 + (char *)&val, sizeof(val)); 1852 + if (rc) 1853 + cFYI(1, ("set TCP_NODELAY socket option error %d", rc)); 1854 + } 1855 + 1852 1856 cFYI(1, ("sndbuf %d rcvbuf %d rcvtimeo 0x%lx", 1853 1857 socket->sk->sk_sndbuf, 1854 1858 socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo)); ··· 1928 1916 ipv6_connect(struct TCP_Server_Info *server) 1929 1917 { 1930 1918 int rc = 0; 1919 + int val; 1931 1920 bool connected = false; 1932 1921 __be16 orig_port = 0; 1933 1922 struct socket *socket = server->ssocket; ··· 2000 1987 */ 2001 1988 socket->sk->sk_rcvtimeo = 7 * HZ; 2002 1989 socket->sk->sk_sndtimeo = 5 * HZ; 1990 + 1991 + if (server->tcp_nodelay) { 1992 + val = 1; 1993 + rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, 1994 + (char *)&val, sizeof(val)); 1995 + if (rc) 1996 + cFYI(1, ("set TCP_NODELAY socket option error %d", rc)); 1997 + } 1998 + 2003 1999 server->ssocket = socket; 2004 2000 2005 2001 return rc;
+11 -1
fs/cifs/inode.c
··· 1762 1762 CIFS_MOUNT_MAP_SPECIAL_CHR); 1763 1763 } 1764 1764 1765 - if (!rc) 1765 + if (!rc) { 1766 1766 rc = inode_setattr(inode, attrs); 1767 + 1768 + /* force revalidate when any of these times are set since some 1769 + of the fs types (eg ext3, fat) do not have fine enough 1770 + time granularity to match protocol, and we do not have a 1771 + a way (yet) to query the server fs's time granularity (and 1772 + whether it rounds times down). 1773 + */ 1774 + if (!rc && (attrs->ia_valid & (ATTR_MTIME | ATTR_CTIME))) 1775 + cifsInode->time = 0; 1776 + } 1767 1777 out: 1768 1778 kfree(args); 1769 1779 kfree(full_path);
+6 -2
fs/cifs/readdir.c
··· 77 77 78 78 cFYI(1, ("For %s", name->name)); 79 79 80 + if (parent->d_op && parent->d_op->d_hash) 81 + parent->d_op->d_hash(parent, name); 82 + else 83 + name->hash = full_name_hash(name->name, name->len); 84 + 80 85 dentry = d_lookup(parent, name); 81 86 if (dentry) { 82 87 /* FIXME: check for inode number changes? */ ··· 671 666 min(len, max_len), nlt, 672 667 cifs_sb->mnt_cifs_flags & 673 668 CIFS_MOUNT_MAP_SPECIAL_CHR); 669 + pqst->len -= nls_nullsize(nlt); 674 670 } else { 675 671 pqst->name = filename; 676 672 pqst->len = len; 677 673 } 678 - pqst->hash = full_name_hash(pqst->name, pqst->len); 679 - /* cFYI(1, ("filldir on %s",pqst->name)); */ 680 674 return rc; 681 675 } 682 676
+5 -6
fs/cifs/sess.c
··· 223 223 /* null user mount */ 224 224 *bcc_ptr = 0; 225 225 *(bcc_ptr+1) = 0; 226 - } else { /* 300 should be long enough for any conceivable user name */ 226 + } else { 227 227 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->userName, 228 - 300, nls_cp); 228 + MAX_USERNAME_SIZE, nls_cp); 229 229 } 230 230 bcc_ptr += 2 * bytes_ret; 231 231 bcc_ptr += 2; /* account for null termination */ ··· 246 246 /* copy user */ 247 247 if (ses->userName == NULL) { 248 248 /* BB what about null user mounts - check that we do this BB */ 249 - } else { /* 300 should be long enough for any conceivable user name */ 250 - strncpy(bcc_ptr, ses->userName, 300); 249 + } else { 250 + strncpy(bcc_ptr, ses->userName, MAX_USERNAME_SIZE); 251 251 } 252 - /* BB improve check for overflow */ 253 - bcc_ptr += strnlen(ses->userName, 300); 252 + bcc_ptr += strnlen(ses->userName, MAX_USERNAME_SIZE); 254 253 *bcc_ptr = 0; 255 254 bcc_ptr++; /* account for null termination */ 256 255