diff mbox

[01/13] cifs: don't fail writepages on -EAGAIN errors

Message ID 1291995877-2276-2-git-send-email-jlayton@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jeff Layton Dec. 10, 2010, 3:44 p.m. UTC
None
diff mbox

Patch

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index fe16f6d..8e57370 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1430,6 +1430,7 @@  retry:
 				break;
 		}
 		if (n_iov) {
+retry_write:
 			open_file = find_writable_file(CIFS_I(mapping->host),
 							false);
 			if (!open_file) {
@@ -1445,22 +1446,20 @@  retry:
 				cifs_update_eof(cifsi, offset, bytes_written);
 			}
 
-			if (rc || bytes_written < bytes_to_write) {
-				cERROR(1, "Write2 ret %d, wrote %d",
-					  rc, bytes_written);
-				mapping_set_error(mapping, rc);
-			} else {
+			/* retry on data-integrity flush */
+			if (rc == -EAGAIN && wbc->sync_mode == WB_SYNC_ALL)
+				goto retry_write;
+
+			if (!rc)
 				cifs_stats_bytes_written(tcon, bytes_written);
-			}
+			else if (rc != -EAGAIN)
+				mapping_set_error(mapping, rc);
 
 			for (i = 0; i < n_iov; i++) {
 				page = pvec.pages[first + i];
-				/* Should we also set page error on
-				success rc but too little data written? */
-				/* BB investigate retry logic on temporary
-				server crash cases and how recovery works
-				when page marked as error */
-				if (rc)
+				if (rc == -EAGAIN)
+					redirty_page_for_writepage(wbc, page);
+				else if (rc != 0)
 					SetPageError(page);
 				kunmap(page);
 				unlock_page(page);