Skip to content

Commit

Permalink
f2fs: avoid fsync() failure caused by EAGAIN in writepage()
Browse files Browse the repository at this point in the history
pageout() in MM traslates EAGAIN, so calls handle_write_error()
 -> mapping_set_error() -> set_bit(AS_EIO, ...).
 file_write_and_wait_range() will see EIO error, which is critical
 to return value of fsync() followed by atomic_write failure to user.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Jaegeuk Kim committed May 4, 2018
1 parent 61ff769 commit 8c088f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion fs/f2fs/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -1885,7 +1885,13 @@ static int __write_data_page(struct page *page, bool *submitted,

redirty_out:
redirty_page_for_writepage(wbc, page);
if (!err)
/*
* pageout() in MM traslates EAGAIN, so calls handle_write_error()
* -> mapping_set_error() -> set_bit(AS_EIO, ...).
* file_write_and_wait_range() will see EIO error, which is critical
* to return value of fsync() followed by atomic_write failure to user.
*/
if (!err || wbc->for_reclaim)
return AOP_WRITEPAGE_ACTIVATE;
unlock_page(page);
return err;
Expand Down

0 comments on commit 8c088f4

Please sign in to comment.