[linux-cifs-client] [PATCH 4/4] CIFS fixes for 2.4.x

Sergey Vlasov vsu at altlinux.ru
Thu Apr 8 15:48:39 GMT 2004


This patch fixes the sock_sendmsg() handling in smb_send().

sock_sendmsg() can perform a partial write, therefore checking its
return value only for an error code is insufficient.  This patch
fixes the loop in smb_send() to handle the partial write case
correctly.

Without this patch I still experienced intermittent errors during
large file writes.


--- kernel-source-cifs-1.0.2/transport.c.send-count	2004-04-08 15:05:46 +0400
+++ kernel-source-cifs-1.0.2/transport.c	2004-04-08 15:06:45 +0400
@@ -149,10 +149,16 @@ smb_send(struct socket *ssocket, struct 
 
 	temp_fs = get_fs();	/* we must turn off socket api parm checking */
 	set_fs(get_ds());
-	rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
-	while((rc == -ENOSPC) || (rc == -EAGAIN)) {
-		schedule_timeout(HZ/2);
-		rc = sock_sendmsg(ssocket, &smb_msg, smb_buf_length + 4);
+	while (iov.iov_len > 0) {
+		rc = sock_sendmsg(ssocket, &smb_msg, iov.iov_len);
+		if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
+			schedule_timeout(HZ/2);
+			continue;
+		}
+		if (rc < 0)
+			break;
+		iov.iov_base += rc;
+		iov.iov_len -= rc;
 	}
 	set_fs(temp_fs);
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/linux-cifs-client/attachments/20040408/10d163cb/attachment.bin


More information about the linux-cifs-client mailing list