diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/file.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 0f05cab5d24a..8a49b2e77d37 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1245,14 +1245,21 @@ retry: | |||
1245 | wait_on_page_writeback(page); | 1245 | wait_on_page_writeback(page); |
1246 | 1246 | ||
1247 | if (PageWriteback(page) || | 1247 | if (PageWriteback(page) || |
1248 | !test_clear_page_dirty(page)) { | 1248 | !clear_page_dirty_for_io(page)) { |
1249 | unlock_page(page); | 1249 | unlock_page(page); |
1250 | break; | 1250 | break; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | /* | ||
1254 | * This actually clears the dirty bit in the radix tree. | ||
1255 | * See cifs_writepage() for more commentary. | ||
1256 | */ | ||
1257 | set_page_writeback(page); | ||
1258 | |||
1253 | if (page_offset(page) >= mapping->host->i_size) { | 1259 | if (page_offset(page) >= mapping->host->i_size) { |
1254 | done = 1; | 1260 | done = 1; |
1255 | unlock_page(page); | 1261 | unlock_page(page); |
1262 | end_page_writeback(page); | ||
1256 | break; | 1263 | break; |
1257 | } | 1264 | } |
1258 | 1265 | ||
@@ -1316,6 +1323,7 @@ retry: | |||
1316 | SetPageError(page); | 1323 | SetPageError(page); |
1317 | kunmap(page); | 1324 | kunmap(page); |
1318 | unlock_page(page); | 1325 | unlock_page(page); |
1326 | end_page_writeback(page); | ||
1319 | page_cache_release(page); | 1327 | page_cache_release(page); |
1320 | } | 1328 | } |
1321 | if ((wbc->nr_to_write -= n_iov) <= 0) | 1329 | if ((wbc->nr_to_write -= n_iov) <= 0) |
@@ -1352,11 +1360,23 @@ static int cifs_writepage(struct page* page, struct writeback_control *wbc) | |||
1352 | if (!PageUptodate(page)) { | 1360 | if (!PageUptodate(page)) { |
1353 | cFYI(1, ("ppw - page not up to date")); | 1361 | cFYI(1, ("ppw - page not up to date")); |
1354 | } | 1362 | } |
1355 | 1363 | ||
1364 | /* | ||
1365 | * Set the "writeback" flag, and clear "dirty" in the radix tree. | ||
1366 | * | ||
1367 | * A writepage() implementation always needs to do either this, | ||
1368 | * or re-dirty the page with "redirty_page_for_writepage()" in | ||
1369 | * the case of a failure. | ||
1370 | * | ||
1371 | * Just unlocking the page will cause the radix tree tag-bits | ||
1372 | * to fail to update with the state of the page correctly. | ||
1373 | */ | ||
1374 | set_page_writeback(page); | ||
1356 | rc = cifs_partialpagewrite(page, 0, PAGE_CACHE_SIZE); | 1375 | rc = cifs_partialpagewrite(page, 0, PAGE_CACHE_SIZE); |
1357 | SetPageUptodate(page); /* BB add check for error and Clearuptodate? */ | 1376 | SetPageUptodate(page); /* BB add check for error and Clearuptodate? */ |
1358 | unlock_page(page); | 1377 | unlock_page(page); |
1359 | page_cache_release(page); | 1378 | end_page_writeback(page); |
1379 | page_cache_release(page); | ||
1360 | FreeXid(xid); | 1380 | FreeXid(xid); |
1361 | return rc; | 1381 | return rc; |
1362 | } | 1382 | } |