If CIFSSMBWrite2 returns -EAGAIN, then we should retry the write instead
of setting an error on the mapping and returning.

Note that I'm not 100% thrilled with this patch. If we have an
unresponsive server then we'll block in cifs_writepages for quite some
time, even in the WB_SYNC_NONE case. That said, we already block in this
function in the WB_SYNC_NONE case since CIFSSMBWrite2 is always
synchronous anyway, so I don't see this as causing any more harm than is
already done.

Signed-off-by: Jeff Layton <[email protected]>
---
 fs/cifs/file.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b857ce5..cde1591 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1432,6 +1432,7 @@ retry:
                                break;
                }
                if (n_iov) {
+retry_write:
                        open_file = find_writable_file(CIFS_I(mapping->host),
                                                        false);
                        if (!open_file) {
@@ -1447,6 +1448,9 @@ retry:
                                cifs_update_eof(cifsi, offset, bytes_written);
                        }
 
+                       if (rc == -EAGAIN)
+                               goto retry_write;
+
                        if (rc || bytes_written < bytes_to_write) {
                                cERROR(1, "Write2 ret %d, wrote %d",
                                          rc, bytes_written);
-- 
1.7.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to