OSDN Git Service

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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Apr 2017 07:31:19 +0000 (09:31 +0200)
commit730fecb3401f8a7cc84e8d7b454976efdfdc65c9
treeb9445e8fd2449e3e746aaff0019430df4a5c83a2
parent3d8d2f2344767cbab597027e2cde21d1a8b32cca
CIFS: store results of cifs_reopen_file to avoid infinite wait

commit 1fa839b4986d648b907d117275869a0e46c324b9 upstream.

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>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/file.c