[CIFS] fix error in smb_send2
authorSteve French <sfrench@us.ibm.com>
Thu, 30 Oct 2008 20:15:22 +0000 (20:15 +0000)
committerSteve French <sfrench@us.ibm.com>
Thu, 30 Oct 2008 20:15:22 +0000 (20:15 +0000)
smb_send2 exit logic was strange, and with the previous change
could cause us to fail large
smb writes when all of the smb was not sent as one chunk.

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
fs/cifs/cifssmb.c
fs/cifs/file.c
fs/cifs/transport.c

index 843a85fb8b9ac8a1189016be9ac59f6b0b8767f4..d5eac48fc41525494d017afd84d14d3d550b1cd8 100644 (file)
@@ -1536,7 +1536,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
        __u32 bytes_sent;
        __u16 byte_count;
 
-       /* cFYI(1,("write at %lld %d bytes",offset,count));*/
+       /* cFYI(1, ("write at %lld %d bytes", offset, count));*/
        if (tcon->ses == NULL)
                return -ECONNABORTED;
 
index 62d8bd8f14c086f1c9f53640b9144f1cca349289..ead1a3bb02564722f98e3f93aa068ade04022503 100644 (file)
@@ -1824,7 +1824,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
        pTcon = cifs_sb->tcon;
 
        pagevec_init(&lru_pvec, 0);
-               cFYI(DBG2, ("rpages: num pages %d", num_pages));
+       cFYI(DBG2, ("rpages: num pages %d", num_pages));
        for (i = 0; i < num_pages; ) {
                unsigned contig_pages;
                struct page *tmp_page;
index ba4d66644ebf165baf0008108183f48bdb54d462..ff8243a8fe3e955757cf087d53c6dbd5bc6befc1 100644 (file)
@@ -290,8 +290,11 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
                if (rc < 0)
                        break;
 
-               if (rc >= total_len) {
-                       WARN_ON(rc > total_len);
+               if (rc == total_len) {
+                       total_len = 0;
+                       break;
+               } else if (rc > total_len) {
+                       cERROR(1, ("sent %d requested %d", rc, total_len));
                        break;
                }
                if (rc == 0) {