From: Jaegeuk Kim Date: Fri, 4 May 2018 06:26:02 +0000 (-0700) Subject: f2fs: avoid fsync() failure caused by EAGAIN in writepage() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1ccd6c4ff9ccd74bb87903067618815d326af242;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 --- diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index d3636f871b4b..ec3288a3258f 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;