linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: mark mapping with error flag to report errors to userspace
@ 2014-05-12  4:47 Liu Bo
  0 siblings, 0 replies; only message in thread
From: Liu Bo @ 2014-05-12  4:47 UTC (permalink / raw)
  To: linux-btrfs

According to commit 865ffef3797da2cac85b3354b5b6050dc9660978
(fs: fix fsync() error reporting),
it's not stable to just check error pages because pages can be
truncated or invalidated, we should also mark mapping with error
flag so that a later fsync can catch the error.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
 fs/btrfs/extent_io.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 80be17c..d7c7813 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2367,6 +2367,7 @@ int end_extent_writepage(struct page *page, int err, u64 start, u64 end)
 	if (!uptodate) {
 		ClearPageUptodate(page);
 		SetPageError(page);
+		mapping_set_error(page->mapping, ret);
 	}
 	return 0;
 }
@@ -3368,6 +3369,8 @@ done:
 		set_page_writeback(page);
 		end_page_writeback(page);
 	}
+	if (PageError(page))
+		mapping_set_error(page->mapping, ret);
 	unlock_page(page);
 
 done_unlocked:
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-05-12  4:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-12  4:47 [PATCH] Btrfs: mark mapping with error flag to report errors to userspace Liu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).