aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2014-06-27 02:33:11 -0400
committerSteve French <smfrench@gmail.com>2014-08-02 02:23:01 -0400
commit038bc961c31b070269ecd07349a7ee2e839d4fec (patch)
tree813bc174930417fc3c44fbd11c9cb3d68bd27e2f /fs/cifs
parentcc87c47d9d7ac25554aa81cd8ded56e75f79c198 (diff)
CIFS: Fix async reading on reconnects
If we get into read_into_pages() from cifs_readv_receive() and then loose a network, we issue cifs_reconnect that moves all mids to a private list and issue their callbacks. The callback of the async read request sets a mid to retry, frees it and wakes up a process that waits on the rdata completion. After the connection is established we return from read_into_pages() with a short read, use the mid that was freed before and try to read the remaining data from the a newly created socket. Both actions are not what we want to do. In reconnect cases (-EAGAIN) we should not mask off the error with a short read but should return the error code instead. Acked-by: Jeff Layton <jlayton@samba.org> Cc: stable@vger.kernel.org Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index e90a1e9aa627..6b6df30cfd89 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2823,7 +2823,7 @@ cifs_uncached_read_into_pages(struct TCP_Server_Info *server,
2823 total_read += result; 2823 total_read += result;
2824 } 2824 }
2825 2825
2826 return total_read > 0 ? total_read : result; 2826 return total_read > 0 && result != -EAGAIN ? total_read : result;
2827} 2827}
2828 2828
2829ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to) 2829ssize_t cifs_user_readv(struct kiocb *iocb, struct iov_iter *to)
@@ -3231,7 +3231,7 @@ cifs_readpages_read_into_pages(struct TCP_Server_Info *server,
3231 total_read += result; 3231 total_read += result;
3232 } 3232 }
3233 3233
3234 return total_read > 0 ? total_read : result; 3234 return total_read > 0 && result != -EAGAIN ? total_read : result;
3235} 3235}
3236 3236
3237static int cifs_readpages(struct file *file, struct address_space *mapping, 3237static int cifs_readpages(struct file *file, struct address_space *mapping,