Commit 61de800d authored by Steve French's avatar Steve French

[CIFS] fix error in smb_send2

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: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent edf1ae40
...@@ -1536,7 +1536,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, ...@@ -1536,7 +1536,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon,
__u32 bytes_sent; __u32 bytes_sent;
__u16 byte_count; __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) if (tcon->ses == NULL)
return -ECONNABORTED; return -ECONNABORTED;
......
...@@ -1824,7 +1824,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1824,7 +1824,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
pagevec_init(&lru_pvec, 0); 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; ) { for (i = 0; i < num_pages; ) {
unsigned contig_pages; unsigned contig_pages;
struct page *tmp_page; struct page *tmp_page;
......
...@@ -290,8 +290,11 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec, ...@@ -290,8 +290,11 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
if (rc < 0) if (rc < 0)
break; break;
if (rc >= total_len) { if (rc == total_len) {
WARN_ON(rc > total_len); total_len = 0;
break;
} else if (rc > total_len) {
cERROR(1, ("sent %d requested %d", rc, total_len));
break; break;
} }
if (rc == 0) { if (rc == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment