diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-04 09:26:02 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-03 08:50:37 +0300 |
commit | 4bbf1ce3a1e3efb6c746e0dbf5a5acb889b3b38b (patch) | |
tree | b73ff4e7f1ccefd5b5bba1da41ae4e1fccadc70d /fs/f2fs | |
parent | 15239633dc559c22aea80b1627176d6bc181b2f7 (diff) | |
download | linux-4bbf1ce3a1e3efb6c746e0dbf5a5acb889b3b38b.tar.xz |
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/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 36b535207c88..85142e5df88b 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1601,7 +1601,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; |