[PATCH v3 11/20] cifs: set mapping error when page writeback fails in writepage or launder_pages

Jeff Layton <[email protected]>
Newsgroups gmane.comp.file-systems.jfs.general
Message-ID <20170424132259.8680-12-jlayton__4588.84159238568$1493044019$gmane$org@redhat.com>
Signed-off-by: Jeff Layton <[email protected]>
---
 fs/cifs/file.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 21d404535739..4b696a23b0b1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2234,14 +2234,16 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)
 	set_page_writeback(page);
 retry_write:
 	rc = cifs_partialpagewrite(page, 0, PAGE_SIZE);
-	if (rc == -EAGAIN && wbc->sync_mode == WB_SYNC_ALL)
+	if (rc == -EAGAIN && wbc->sync_mode == WB_SYNC_ALL) {
 		goto retry_write;
-	else if (rc == -EAGAIN)
+	} else if (rc == -EAGAIN) {
 		redirty_page_for_writepage(wbc, page);
-	else if (rc != 0)
+	} else if (rc != 0) {
 		SetPageError(page);
-	else
+		mapping_set_error(page->mapping, rc);
+	} else {
 		SetPageUptodate(page);
+	}
 	end_page_writeback(page);
 	put_page(page);
 	free_xid(xid);
-- 
2.9.3


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.