cifs: don't fail writepages on -EAGAIN errors (try #2)
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest13 patches 32 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | cifs: don't fail writepages on -EAGAIN errorsfs/ | +11 | 7 replies | |
| 2/13 | cifs: make wait_for_free_request take a TCP_Server_Info pointerfs/ | +13 | 1 reply | |
| 3/13 | cifs: move mid result processing into common functionfs/ | +47 | 3 replies | |
| 4/13 | cifs: wait indefinitely for responsesfs/ | +17 | 1 reply | |
| 5/13 | cifs: don't reconnect server when we don't get a responsefs/ | +1 | 1 reply | |
| 6/13 | cifs: clean up handle_mid_responsefs/ | +18 | 3 replies | |
| 7/13 | cifs: allow for different handling of received responsefs/ fs/ fs/ +1 more | +55 | 1 reply | |
| 8/13 | cifs: handle cancelled requests betterfs/ fs/ fs/ +1 more | +61 | 9 replies | |
| 9/13 | cifs: add cifs_call_asyncfs/ fs/ | +57 | 1 reply | |
| 10/13 | cifs: add ability to send an echo requestfs/ fs/ fs/ | +63 | 1 reply | |
| 11/13 | cifs: set up recurring workqueue job to do SMB echo requestsfs/ fs/ | +30 | 1 reply | |
| 12/13 | cifs: reconnect unresponsive serversfs/ | +19 | 1 reply | |
| 13/13 | cifs: remove code for setting timeouts on requestsfs/ fs/ fs/ +3 more | +17 | 1 reply |
Reviews trailers per patch
12 of 13 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Pavel Shilovsky |
|---|---|
| Series | R-b |
| 1/13 | R-b |
| 2/13 | R-b |
| 3/13 | R-b |
| 4/13 | R-b |
| 5/13 | R-b |
| 6/13 | R-b |
| 7/13 | R-b |
| 8/13 | R-b |
| 9/13 | R-b |
| 10/13 | R-b |
| 11/13 | R-b |
| 12/13 | R-b |
| 13/13 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 00/13] cifs: don't fail writepages on -EAGAIN errors (try #2)
If CIFSSMBWrite2 returns -EAGAIN, then the error should be considered temporary. CIFS should retry the write instead of setting an error on the mapping and returning.
For WB_SYNC_ALL, just retry the write immediately. In the WB_SYNC_NONE case, call redirty_page_for_writeback on all of the pages that didn't get written out and then move on.
Also, fix up the handling of a short write with a successful return code. MS-CIFS says that 0 bytes_written means ENOSPC or EFBIG. It doesn't mention what a short, but non-zero write means, so for now treat it as we would an -EAGAIN return.
--- fs/cifs/file.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 36 insertions(+), 12 deletions(-)
fs/cifs/file.c +36 -12
@@ -1430,6 +1430,7 @@ retry:break ; }if (n_iov) { +retry_write: open_file =find_writable_file (CIFS_I (mapping->host), false);if (!open_file) {
@@ -1442,31 +1443,54 @@ retry: &bytes_written, iov, n_iov, long_op);cifsFileInfo_put (open_file); -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 { +cFYI (1 ,"Write2 rc=%d, wrote=%u" , rc, bytes_written); + +/* +* For now, treat a short write as if nothing got +* written. A zero length write however indicates +* ENOSPC or EFBIG. We have no way to know which +* though, so call it ENOSPC for now. EFBIG would +* get translated to AS_EIO anyway. +* +* FIXME: make it take into account the data that did +* get written +*/ +if (rc ==0 ) { +if (bytes_written ==0 ) + rc = -ENOSPC ; +else if (bytes_written < bytes_to_write) + rc = -EAGAIN ; + } + +/* retry on data-integrity flush */ +if (wbc->sync_mode ==WB_SYNC_ALL && + (rc == -EAGAIN || bytes_written < bytes_to_write)) + goto retry_write; + +/* fix the stats and EOF */ +if (bytes_written >0 ) {cifs_stats_bytes_written (tcon, bytes_written); +cifs_update_eof (cifsi, offset, bytes_written); }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) +/* on retryable write error, redirty page */ +if (rc == -EAGAIN ) +redirty_page_for_writepage (wbc, page); +else if (rc !=0 )SetPageError (page);kunmap (page);unlock_page (page);end_page_writeback (page);page_cache_release (page); } + +if (rc != -EAGAIN ) +mapping_set_error (mapping, rc); +if ((wbc->nr_to_write -= n_iov) <=0 ) done =1 ; index = next;
Signature · 1 line
1.7.3.2