CIFS: store results of cifs_reopen_file to avoid infinite wait
authorGermano Percossi <germano.percossi@citrix.com>
Fri, 7 Apr 2017 11:29:38 +0000 (12:29 +0100)
committerSteve French <smfrench@gmail.com>
Tue, 11 Apr 2017 04:36:39 +0000 (23:36 -0500)
commit1fa839b4986d648b907d117275869a0e46c324b9
treefe4a98da41574596008a9fa7f85776fb09622ef3
parenta0918f1ce6a43ac980b42b300ec443c154970979
CIFS: store results of cifs_reopen_file to avoid infinite wait

This fixes Continuous Availability when errors during
file reopen are encountered.

cifs_user_readv and cifs_user_writev would wait for ever if
results of cifs_reopen_file are not stored and for later inspection.

In fact, results are checked and, in case of errors, a chain
of function calls leading to reads and writes to be scheduled in
a separate thread is skipped.
These threads will wake up the corresponding waiters once reads
and writes are done.

However, given the return value is not stored, when rc is checked
for errors a previous one (always zero) is inspected instead.
This leads to pending reads/writes added to the list, making
cifs_user_readv and cifs_user_writev wait for ever.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <smfrench@gmail.com>
fs/cifs/file.c