summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-05-03 23:26:02 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-08-03 07:47:55 +0200
commit4fc891a62cecb43b0be4c2a8f676d74efba6131f (patch)
treeb263d89a57000b6a36d13005c50f4bd6b29f7f2e /fs
parentd7825eb34a1a8cf09dd66cf370efcc4a406d49ef (diff)
downloadlinux-stable-4fc891a62cecb43b0be4c2a8f676d74efba6131f.tar.gz
linux-stable-4fc891a62cecb43b0be4c2a8f676d74efba6131f.tar.bz2
linux-stable-4fc891a62cecb43b0be4c2a8f676d74efba6131f.zip
f2fs: avoid fsync() failure caused by EAGAIN in writepage()
[ Upstream commit 5b19d284f5195a925dd015a6397bfce184097378 ] 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> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 3dbd7ca2988e..a9fec79dc3dd 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -1848,7 +1848,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;