CIFS: Fix async reading on reconnects
authorPavel Shilovsky <pshilovsky@samba.org>
Fri, 27 Jun 2014 06:33:11 +0000 (10:33 +0400)
committerJiri Slaby <jslaby@suse.cz>
Wed, 17 Sep 2014 15:06:53 +0000 (17:06 +0200)
commit98bbdfdb93af137f5364dddff5286633644cc9d1
tree9677be8405af52808d3d79ee7ea81ea11ac3f7f1
parent7aadcce63d6b631f92bb2b8ff5eb8e284be81708
CIFS: Fix async reading on reconnects

commit 038bc961c31b070269ecd07349a7ee2e839d4fec upstream.

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>
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
fs/cifs/file.c