diff mbox series

ceph: clear page dirty before invalidate page

Message ID 20190724022609.15652-1-chenerqi@gmail.com (mailing list archive)
State New, archived
Headers show
Series ceph: clear page dirty before invalidate page | expand

Commit Message

erqi chen July 24, 2019, 2:26 a.m. UTC
From: Erqi Chen <chenerqi@gmail.com>

clear_page_dirty_for_io(page) before mapping->a_ops->invalidatepage().
invalidatepage() clears page's private flag, if dirty flag is not
cleared, the page may cause BUG_ON failure in ceph_set_page_dirty().

Fixes: https://tracker.ceph.com/issues/40862
Signed-off-by: Erqi Chen chenerqi@gmail.com
---
 fs/ceph/addr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index e078cc5..5d3f2dd 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -913,8 +913,9 @@  static int ceph_writepages_start(struct address_space *mapping,
 			if (page_offset(page) >= ceph_wbc.i_size) {
 				dout("%p page eof %llu\n",
 				     page, ceph_wbc.i_size);
-				if (ceph_wbc.size_stable ||
+				if ((ceph_wbc.size_stable ||
 				    page_offset(page) >= i_size_read(inode))
+				    && clear_page_dirty_for_io(page))
 					mapping->a_ops->invalidatepage(page,
 								0, PAGE_SIZE);
 				unlock_page(page);