aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/data.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-05-03 23:26:02 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-04 10:51:22 -0700
commit5b19d284f5195a925dd015a6397bfce184097378 (patch)
tree2d01d08c74de0967b1fe627fecb415bbd1826dd3 /fs/f2fs/data.c
parentf2fs: clear PageError on writepage (diff)
downloadlinux-dev-5b19d284f5195a925dd015a6397bfce184097378.tar.xz
linux-dev-5b19d284f5195a925dd015a6397bfce184097378.zip
f2fs: avoid fsync() failure caused by EAGAIN in writepage()
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>
Diffstat (limited to 'fs/f2fs/data.c')
-rw-r--r--fs/f2fs/data.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 5477fc09c3cd..ac8720fa5868 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1904,7 +1904,13 @@ out:
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;