Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: make sure we allocate enough storage for socket address
[CIFS] Make socket retry timeouts consistent between blocking and nonblocking cases
[CIFS] some cleanup to dir.c prior to addition of posix_open
[CIFS] revalidate parent inode when rmdir done within that directory
[CIFS] Rename md5 functions to avoid collision with new rt modules
cifs: turn smb_send into a wrapper around smb_sendv

+121 -161
+3 -1
fs/cifs/CHANGES
··· 5 5 support posix byte range locks. Fix query of root inode when prefixpath 6 6 specified and user does not have access to query information about the 7 7 top of the share. Fix problem in 2.6.28 resolving DFS paths to 8 - Samba servers (worked to Windows). 8 + Samba servers (worked to Windows). Fix rmdir so that pending search 9 + (readdir) requests do not get invalid results which include the now 10 + removed directory. 9 11 10 12 Version 1.55 11 13 ------------
+9 -9
fs/cifs/cifsencrypt.c
··· 48 48 if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL)) 49 49 return -EINVAL; 50 50 51 - MD5Init(&context); 52 - MD5Update(&context, (char *)&key->data, key->len); 53 - MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length); 51 + cifs_MD5_init(&context); 52 + cifs_MD5_update(&context, (char *)&key->data, key->len); 53 + cifs_MD5_update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length); 54 54 55 - MD5Final(signature, &context); 55 + cifs_MD5_final(signature, &context); 56 56 return 0; 57 57 } 58 58 ··· 96 96 if ((iov == NULL) || (signature == NULL) || (key == NULL)) 97 97 return -EINVAL; 98 98 99 - MD5Init(&context); 100 - MD5Update(&context, (char *)&key->data, key->len); 99 + cifs_MD5_init(&context); 100 + cifs_MD5_update(&context, (char *)&key->data, key->len); 101 101 for (i = 0; i < n_vec; i++) { 102 102 if (iov[i].iov_len == 0) 103 103 continue; ··· 110 110 if (i == 0) { 111 111 if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ 112 112 break; /* nothing to sign or corrupt header */ 113 - MD5Update(&context, iov[0].iov_base+4, 113 + cifs_MD5_update(&context, iov[0].iov_base+4, 114 114 iov[0].iov_len-4); 115 115 } else 116 - MD5Update(&context, iov[i].iov_base, iov[i].iov_len); 116 + cifs_MD5_update(&context, iov[i].iov_base, iov[i].iov_len); 117 117 } 118 118 119 - MD5Final(signature, &context); 119 + cifs_MD5_final(signature, &context); 120 120 121 121 return 0; 122 122 }
+2 -2
fs/cifs/cifsproto.h
··· 35 35 extern void cifs_buf_release(void *); 36 36 extern struct smb_hdr *cifs_small_buf_get(void); 37 37 extern void cifs_small_buf_release(void *); 38 - extern int smb_send(struct socket *, struct smb_hdr *, 39 - unsigned int /* length */ , struct sockaddr *, bool); 38 + extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, 39 + unsigned int /* length */); 40 40 extern unsigned int _GetXid(void); 41 41 extern void _FreeXid(unsigned int); 42 42 #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid()));
+11 -13
fs/cifs/connect.c
··· 1354 1354 } 1355 1355 1356 1356 static struct TCP_Server_Info * 1357 - cifs_find_tcp_session(struct sockaddr *addr) 1357 + cifs_find_tcp_session(struct sockaddr_storage *addr) 1358 1358 { 1359 1359 struct list_head *tmp; 1360 1360 struct TCP_Server_Info *server; ··· 1374 1374 if (server->tcpStatus == CifsNew) 1375 1375 continue; 1376 1376 1377 - if (addr->sa_family == AF_INET && 1377 + if (addr->ss_family == AF_INET && 1378 1378 (addr4->sin_addr.s_addr != 1379 1379 server->addr.sockAddr.sin_addr.s_addr)) 1380 1380 continue; 1381 - else if (addr->sa_family == AF_INET6 && 1381 + else if (addr->ss_family == AF_INET6 && 1382 1382 memcmp(&server->addr.sockAddr6.sin6_addr, 1383 1383 &addr6->sin6_addr, sizeof(addr6->sin6_addr))) 1384 1384 continue; ··· 1419 1419 cifs_get_tcp_session(struct smb_vol *volume_info) 1420 1420 { 1421 1421 struct TCP_Server_Info *tcp_ses = NULL; 1422 - struct sockaddr addr; 1422 + struct sockaddr_storage addr; 1423 1423 struct sockaddr_in *sin_server = (struct sockaddr_in *) &addr; 1424 1424 struct sockaddr_in6 *sin_server6 = (struct sockaddr_in6 *) &addr; 1425 1425 int rc; 1426 1426 1427 - memset(&addr, 0, sizeof(struct sockaddr)); 1427 + memset(&addr, 0, sizeof(struct sockaddr_storage)); 1428 1428 1429 1429 if (volume_info->UNCip && volume_info->UNC) { 1430 1430 rc = cifs_inet_pton(AF_INET, volume_info->UNCip, ··· 1435 1435 rc = cifs_inet_pton(AF_INET6, volume_info->UNCip, 1436 1436 &sin_server6->sin6_addr.in6_u); 1437 1437 if (rc > 0) 1438 - addr.sa_family = AF_INET6; 1438 + addr.ss_family = AF_INET6; 1439 1439 } else { 1440 - addr.sa_family = AF_INET; 1440 + addr.ss_family = AF_INET; 1441 1441 } 1442 1442 1443 1443 if (rc <= 0) { ··· 1502 1502 tcp_ses->tcpStatus = CifsNew; 1503 1503 ++tcp_ses->srv_count; 1504 1504 1505 - if (addr.sa_family == AF_INET6) { 1505 + if (addr.ss_family == AF_INET6) { 1506 1506 cFYI(1, ("attempting ipv6 connect")); 1507 1507 /* BB should we allow ipv6 on port 139? */ 1508 1508 /* other OS never observed in Wild doing 139 with v6 */ ··· 1802 1802 * user space buffer 1803 1803 */ 1804 1804 socket->sk->sk_rcvtimeo = 7 * HZ; 1805 - socket->sk->sk_sndtimeo = 3 * HZ; 1805 + socket->sk->sk_sndtimeo = 5 * HZ; 1806 1806 1807 1807 /* make the bufsizes depend on wsize/rsize and max requests */ 1808 1808 if (server->noautotune) { ··· 1860 1860 smb_buf = (struct smb_hdr *)ses_init_buf; 1861 1861 /* sizeof RFC1002_SESSION_REQUEST with no scope */ 1862 1862 smb_buf->smb_buf_length = 0x81000044; 1863 - rc = smb_send(socket, smb_buf, 0x44, 1864 - (struct sockaddr *) &server->addr.sockAddr, 1865 - server->noblocksnd); 1863 + rc = smb_send(server, smb_buf, 0x44); 1866 1864 kfree(ses_init_buf); 1867 1865 msleep(1); /* RFC1001 layer in at least one server 1868 1866 requires very short break before negprot ··· 1953 1955 * user space buffer 1954 1956 */ 1955 1957 socket->sk->sk_rcvtimeo = 7 * HZ; 1956 - socket->sk->sk_sndtimeo = 3 * HZ; 1958 + socket->sk->sk_sndtimeo = 5 * HZ; 1957 1959 server->ssocket = socket; 1958 1960 1959 1961 return rc;
+31 -25
fs/cifs/dir.c
··· 129 129 return full_path; 130 130 } 131 131 132 + static void setup_cifs_dentry(struct cifsTconInfo *tcon, 133 + struct dentry *direntry, 134 + struct inode *newinode) 135 + { 136 + if (tcon->nocase) 137 + direntry->d_op = &cifs_ci_dentry_ops; 138 + else 139 + direntry->d_op = &cifs_dentry_ops; 140 + d_instantiate(direntry, newinode); 141 + } 142 + 132 143 /* Inode operations in similar order to how they appear in Linux file fs.h */ 133 144 134 145 int ··· 150 139 int xid; 151 140 int create_options = CREATE_NOT_DIR; 152 141 int oplock = 0; 142 + /* BB below access is too much for the mknod to request */ 153 143 int desiredAccess = GENERIC_READ | GENERIC_WRITE; 154 144 __u16 fileHandle; 155 145 struct cifs_sb_info *cifs_sb; 156 - struct cifsTconInfo *pTcon; 146 + struct cifsTconInfo *tcon; 157 147 char *full_path = NULL; 158 148 FILE_ALL_INFO *buf = NULL; 159 149 struct inode *newinode = NULL; 160 - struct cifsFileInfo *pCifsFile = NULL; 161 150 struct cifsInodeInfo *pCifsInode; 162 151 int disposition = FILE_OVERWRITE_IF; 163 152 bool write_only = false; ··· 165 154 xid = GetXid(); 166 155 167 156 cifs_sb = CIFS_SB(inode->i_sb); 168 - pTcon = cifs_sb->tcon; 157 + tcon = cifs_sb->tcon; 169 158 170 159 full_path = build_path_from_dentry(direntry); 171 160 if (full_path == NULL) { 172 161 FreeXid(xid); 173 162 return -ENOMEM; 174 163 } 164 + 165 + mode &= ~current->fs->umask; 175 166 176 167 if (nd && (nd->flags & LOOKUP_OPEN)) { 177 168 int oflags = nd->intent.open.flags; ··· 209 196 return -ENOMEM; 210 197 } 211 198 212 - mode &= ~current->fs->umask; 213 - 214 199 /* 215 200 * if we're not using unix extensions, see if we need to set 216 201 * ATTR_READONLY on the create call 217 202 */ 218 - if (!pTcon->unix_ext && (mode & S_IWUGO) == 0) 203 + if (!tcon->unix_ext && (mode & S_IWUGO) == 0) 219 204 create_options |= CREATE_OPTION_READONLY; 220 205 221 206 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 222 - rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, 207 + rc = CIFSSMBOpen(xid, tcon, full_path, disposition, 223 208 desiredAccess, create_options, 224 209 &fileHandle, &oplock, buf, cifs_sb->local_nls, 225 210 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ··· 226 215 227 216 if (rc == -EIO) { 228 217 /* old server, retry the open legacy style */ 229 - rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 218 + rc = SMBLegacyOpen(xid, tcon, full_path, disposition, 230 219 desiredAccess, create_options, 231 220 &fileHandle, &oplock, buf, cifs_sb->local_nls, 232 221 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ··· 236 225 } else { 237 226 /* If Open reported that we actually created a file 238 227 then we now have to set the mode if possible */ 239 - if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 228 + if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 240 229 struct cifs_unix_set_info_args args = { 241 230 .mode = mode, 242 231 .ctime = NO_CHANGE_64, ··· 255 244 args.uid = NO_CHANGE_64; 256 245 args.gid = NO_CHANGE_64; 257 246 } 258 - CIFSSMBUnixSetInfo(xid, pTcon, full_path, &args, 247 + CIFSSMBUnixSetInfo(xid, tcon, full_path, &args, 259 248 cifs_sb->local_nls, 260 249 cifs_sb->mnt_cifs_flags & 261 250 CIFS_MOUNT_MAP_SPECIAL_CHR); 262 251 } else { 263 252 /* BB implement mode setting via Windows security 264 253 descriptors e.g. */ 265 - /* CIFSSMBWinSetPerms(xid,pTcon,path,mode,-1,-1,nls);*/ 254 + /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/ 266 255 267 256 /* Could set r/o dos attribute if mode & 0222 == 0 */ 268 257 } 269 258 270 259 /* server might mask mode so we have to query for it */ 271 - if (pTcon->unix_ext) 260 + if (tcon->unix_ext) 272 261 rc = cifs_get_inode_info_unix(&newinode, full_path, 273 262 inode->i_sb, xid); 274 263 else { ··· 294 283 } 295 284 296 285 if (rc != 0) { 297 - cFYI(1, 298 - ("Create worked but get_inode_info failed rc = %d", 299 - rc)); 300 - } else { 301 - if (pTcon->nocase) 302 - direntry->d_op = &cifs_ci_dentry_ops; 303 - else 304 - direntry->d_op = &cifs_dentry_ops; 305 - d_instantiate(direntry, newinode); 306 - } 286 + cFYI(1, ("Create worked, get_inode_info failed rc = %d", 287 + rc)); 288 + } else 289 + setup_cifs_dentry(tcon, direntry, newinode); 290 + 307 291 if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || 308 292 (!(nd->flags & LOOKUP_OPEN))) { 309 293 /* mknod case - do not leave file open */ 310 - CIFSSMBClose(xid, pTcon, fileHandle); 294 + CIFSSMBClose(xid, tcon, fileHandle); 311 295 } else if (newinode) { 312 - pCifsFile = 296 + struct cifsFileInfo *pCifsFile = 313 297 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 314 298 315 299 if (pCifsFile == NULL) ··· 322 316 /* set the following in open now 323 317 pCifsFile->pfile = file; */ 324 318 write_lock(&GlobalSMBSeslock); 325 - list_add(&pCifsFile->tlist, &pTcon->openFileList); 319 + list_add(&pCifsFile->tlist, &tcon->openFileList); 326 320 pCifsInode = CIFS_I(newinode); 327 321 if (pCifsInode) { 328 322 /* if readable file instance put first in list*/
+5
fs/cifs/inode.c
··· 1285 1285 cifsInode = CIFS_I(direntry->d_inode); 1286 1286 cifsInode->time = 0; /* force revalidate to go get info when 1287 1287 needed */ 1288 + 1289 + cifsInode = CIFS_I(inode); 1290 + cifsInode->time = 0; /* force revalidate to get parent dir info 1291 + since cached search results now invalid */ 1292 + 1288 1293 direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = 1289 1294 current_fs_time(inode->i_sb); 1290 1295
+19 -19
fs/cifs/md5.c
··· 10 10 * with every copy. 11 11 * 12 12 * To compute the message digest of a chunk of bytes, declare an 13 - * MD5Context structure, pass it to MD5Init, call MD5Update as 14 - * needed on buffers full of bytes, and then call MD5Final, which 13 + * MD5Context structure, pass it to cifs_MD5_init, call cifs_MD5_update as 14 + * needed on buffers full of bytes, and then call cifs_MD5_final, which 15 15 * will fill a supplied 16-byte array with the digest. 16 16 */ 17 17 ··· 45 45 * initialization constants. 46 46 */ 47 47 void 48 - MD5Init(struct MD5Context *ctx) 48 + cifs_MD5_init(struct MD5Context *ctx) 49 49 { 50 50 ctx->buf[0] = 0x67452301; 51 51 ctx->buf[1] = 0xefcdab89; ··· 61 61 * of bytes. 62 62 */ 63 63 void 64 - MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) 64 + cifs_MD5_update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) 65 65 { 66 66 register __u32 t; 67 67 ··· 110 110 * 1 0* (64-bit count of bits processed, MSB-first) 111 111 */ 112 112 void 113 - MD5Final(unsigned char digest[16], struct MD5Context *ctx) 113 + cifs_MD5_final(unsigned char digest[16], struct MD5Context *ctx) 114 114 { 115 115 unsigned int count; 116 116 unsigned char *p; ··· 165 165 166 166 /* 167 167 * The core of the MD5 algorithm, this alters an existing MD5 hash to 168 - * reflect the addition of 16 longwords of new data. MD5Update blocks 168 + * reflect the addition of 16 longwords of new data. cifs_MD5_update blocks 169 169 * the data and converts bytes into longwords for this routine. 170 170 */ 171 171 static void ··· 267 267 unsigned char tk[16]; 268 268 struct MD5Context tctx; 269 269 270 - MD5Init(&tctx); 271 - MD5Update(&tctx, key, key_len); 272 - MD5Final(tk, &tctx); 270 + cifs_MD5_init(&tctx); 271 + cifs_MD5_update(&tctx, key, key_len); 272 + cifs_MD5_final(tk, &tctx); 273 273 274 274 key = tk; 275 275 key_len = 16; ··· 287 287 ctx->k_opad[i] ^= 0x5c; 288 288 } 289 289 290 - MD5Init(&ctx->ctx); 291 - MD5Update(&ctx->ctx, ctx->k_ipad, 64); 290 + cifs_MD5_init(&ctx->ctx); 291 + cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64); 292 292 } 293 293 #endif 294 294 ··· 317 317 ctx->k_opad[i] ^= 0x5c; 318 318 } 319 319 320 - MD5Init(&ctx->ctx); 321 - MD5Update(&ctx->ctx, ctx->k_ipad, 64); 320 + cifs_MD5_init(&ctx->ctx); 321 + cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64); 322 322 } 323 323 324 324 /*********************************************************************** ··· 328 328 hmac_md5_update(const unsigned char *text, int text_len, 329 329 struct HMACMD5Context *ctx) 330 330 { 331 - MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */ 331 + cifs_MD5_update(&ctx->ctx, text, text_len); /* then text of datagram */ 332 332 } 333 333 334 334 /*********************************************************************** ··· 339 339 { 340 340 struct MD5Context ctx_o; 341 341 342 - MD5Final(digest, &ctx->ctx); 342 + cifs_MD5_final(digest, &ctx->ctx); 343 343 344 - MD5Init(&ctx_o); 345 - MD5Update(&ctx_o, ctx->k_opad, 64); 346 - MD5Update(&ctx_o, digest, 16); 347 - MD5Final(digest, &ctx_o); 344 + cifs_MD5_init(&ctx_o); 345 + cifs_MD5_update(&ctx_o, ctx->k_opad, 64); 346 + cifs_MD5_update(&ctx_o, digest, 16); 347 + cifs_MD5_final(digest, &ctx_o); 348 348 } 349 349 350 350 /***********************************************************
+3 -3
fs/cifs/md5.h
··· 20 20 }; 21 21 #endif /* _HMAC_MD5_H */ 22 22 23 - void MD5Init(struct MD5Context *context); 24 - void MD5Update(struct MD5Context *context, unsigned char const *buf, 23 + void cifs_MD5_init(struct MD5Context *context); 24 + void cifs_MD5_update(struct MD5Context *context, unsigned char const *buf, 25 25 unsigned len); 26 - void MD5Final(unsigned char digest[16], struct MD5Context *context); 26 + void cifs_MD5_final(unsigned char digest[16], struct MD5Context *context); 27 27 28 28 /* The following definitions come from lib/hmacmd5.c */ 29 29
+38 -89
fs/cifs/transport.c
··· 154 154 spin_unlock(&GlobalMid_Lock); 155 155 } 156 156 157 - int 158 - smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer, 159 - unsigned int smb_buf_length, struct sockaddr *sin, bool noblocksnd) 160 - { 161 - int rc = 0; 162 - int i = 0; 163 - struct msghdr smb_msg; 164 - struct kvec iov; 165 - unsigned len = smb_buf_length + 4; 166 - 167 - if (ssocket == NULL) 168 - return -ENOTSOCK; /* BB eventually add reconnect code here */ 169 - iov.iov_base = smb_buffer; 170 - iov.iov_len = len; 171 - 172 - smb_msg.msg_name = sin; 173 - smb_msg.msg_namelen = sizeof(struct sockaddr); 174 - smb_msg.msg_control = NULL; 175 - smb_msg.msg_controllen = 0; 176 - if (noblocksnd) 177 - smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; 178 - else 179 - smb_msg.msg_flags = MSG_NOSIGNAL; 180 - 181 - /* smb header is converted in header_assemble. bcc and rest of SMB word 182 - area, and byte area if necessary, is converted to littleendian in 183 - cifssmb.c and RFC1001 len is converted to bigendian in smb_send 184 - Flags2 is converted in SendReceive */ 185 - 186 - smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length); 187 - cFYI(1, ("Sending smb of length %d", smb_buf_length)); 188 - dump_smb(smb_buffer, len); 189 - 190 - while (len > 0) { 191 - rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, len); 192 - if ((rc == -ENOSPC) || (rc == -EAGAIN)) { 193 - i++; 194 - /* smaller timeout here than send2 since smaller size */ 195 - /* Although it may not be required, this also is smaller 196 - oplock break time */ 197 - if (i > 12) { 198 - cERROR(1, 199 - ("sends on sock %p stuck for 7 seconds", 200 - ssocket)); 201 - rc = -EAGAIN; 202 - break; 203 - } 204 - msleep(1 << i); 205 - continue; 206 - } 207 - if (rc < 0) 208 - break; 209 - else 210 - i = 0; /* reset i after each successful send */ 211 - iov.iov_base += rc; 212 - iov.iov_len -= rc; 213 - len -= rc; 214 - } 215 - 216 - if (rc < 0) { 217 - cERROR(1, ("Error %d sending data on socket to server", rc)); 218 - } else { 219 - rc = 0; 220 - } 221 - 222 - /* Don't want to modify the buffer as a 223 - side effect of this call. */ 224 - smb_buffer->smb_buf_length = smb_buf_length; 225 - 226 - return rc; 227 - } 228 - 229 157 static int 230 - smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec, 231 - struct sockaddr *sin, bool noblocksnd) 158 + smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec) 232 159 { 233 160 int rc = 0; 234 161 int i = 0; ··· 170 243 if (ssocket == NULL) 171 244 return -ENOTSOCK; /* BB eventually add reconnect code here */ 172 245 173 - smb_msg.msg_name = sin; 246 + smb_msg.msg_name = (struct sockaddr *) &server->addr.sockAddr; 174 247 smb_msg.msg_namelen = sizeof(struct sockaddr); 175 248 smb_msg.msg_control = NULL; 176 249 smb_msg.msg_controllen = 0; 177 - if (noblocksnd) 250 + if (server->noblocksnd) 178 251 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; 179 252 else 180 253 smb_msg.msg_flags = MSG_NOSIGNAL; ··· 199 272 n_vec - first_vec, total_len); 200 273 if ((rc == -ENOSPC) || (rc == -EAGAIN)) { 201 274 i++; 202 - if (i >= 14) { 275 + /* if blocking send we try 3 times, since each can block 276 + for 5 seconds. For nonblocking we have to try more 277 + but wait increasing amounts of time allowing time for 278 + socket to clear. The overall time we wait in either 279 + case to send on the socket is about 15 seconds. 280 + Similarly we wait for 15 seconds for 281 + a response from the server in SendReceive[2] 282 + for the server to send a response back for 283 + most types of requests (except SMB Write 284 + past end of file which can be slow, and 285 + blocking lock operations). NFS waits slightly longer 286 + than CIFS, but this can make it take longer for 287 + nonresponsive servers to be detected and 15 seconds 288 + is more than enough time for modern networks to 289 + send a packet. In most cases if we fail to send 290 + after the retries we will kill the socket and 291 + reconnect which may clear the network problem. 292 + */ 293 + if ((i >= 14) || (!server->noblocksnd && (i > 2))) { 203 294 cERROR(1, 204 295 ("sends on sock %p stuck for 15 seconds", 205 296 ssocket)); ··· 282 337 smb_buffer->smb_buf_length = smb_buf_length; 283 338 284 339 return rc; 340 + } 341 + 342 + int 343 + smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer, 344 + unsigned int smb_buf_length) 345 + { 346 + struct kvec iov; 347 + 348 + iov.iov_base = smb_buffer; 349 + iov.iov_len = smb_buf_length + 4; 350 + 351 + return smb_sendv(server, &iov, 1); 285 352 } 286 353 287 354 static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) ··· 497 540 #ifdef CONFIG_CIFS_STATS2 498 541 atomic_inc(&ses->server->inSend); 499 542 #endif 500 - rc = smb_send2(ses->server, iov, n_vec, 501 - (struct sockaddr *) &(ses->server->addr.sockAddr), 502 - ses->server->noblocksnd); 543 + rc = smb_sendv(ses->server, iov, n_vec); 503 544 #ifdef CONFIG_CIFS_STATS2 504 545 atomic_dec(&ses->server->inSend); 505 546 midQ->when_sent = jiffies; ··· 691 736 #ifdef CONFIG_CIFS_STATS2 692 737 atomic_inc(&ses->server->inSend); 693 738 #endif 694 - rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 695 - (struct sockaddr *) &(ses->server->addr.sockAddr), 696 - ses->server->noblocksnd); 739 + rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length); 697 740 #ifdef CONFIG_CIFS_STATS2 698 741 atomic_dec(&ses->server->inSend); 699 742 midQ->when_sent = jiffies; ··· 832 879 mutex_unlock(&ses->server->srv_mutex); 833 880 return rc; 834 881 } 835 - rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 836 - (struct sockaddr *) &(ses->server->addr.sockAddr), 837 - ses->server->noblocksnd); 882 + rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length); 838 883 mutex_unlock(&ses->server->srv_mutex); 839 884 return rc; 840 885 } ··· 924 973 #ifdef CONFIG_CIFS_STATS2 925 974 atomic_inc(&ses->server->inSend); 926 975 #endif 927 - rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 928 - (struct sockaddr *) &(ses->server->addr.sockAddr), 929 - ses->server->noblocksnd); 976 + rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length); 930 977 #ifdef CONFIG_CIFS_STATS2 931 978 atomic_dec(&ses->server->inSend); 932 979 midQ->when_sent = jiffies;