Skip to contentSkip to conversation

ceph: redirty the page for wirtepage if fails

PATCH In review Xiubo Li 2 participants 2 messages Apr 24, 2022 – Apr 25, 2022 Ceph client

lore
Share & tools
lore

Xiubo Li

author
#0 lore raw

PATCH 1/1 ceph: redirty the page for wirtepage if fails

When run out of memories we should redirty the page before failing the writepage. Or we will hit BUG_ON(folio_get_private(folio)) in ceph_dirty_folio().

URL: https://tracker.ceph.com/issues/55421

---
 fs/ceph/addr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ceph/addr.c +3 -1
index 261bc8bb2ab8..656bc0ca7a78 100644
@@ -606,8 +606,10 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
 				    CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE, snapc,
 				    ceph_wbc.truncate_seq, ceph_wbc.truncate_size,
 				    true);
-	if (IS_ERR(req))
+	if (IS_ERR(req)) {
+		redirty_page_for_writepage(wbc, page);
 		return PTR_ERR(req);
+	}
 
 	set_page_writeback(page);
 	if (caching)
Signature · 1 line
2.36.0.rc1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Xiubo Li

When run out of memories we should redirty the page before failing the writepage. Or we will hit BUG_ON(folio_get_private(folio)) in ceph_dirty_folio().

URL: https://tracker.ceph.com/issues/55421

---
 fs/ceph/addr.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ceph/addr.c +0 -0
index 261bc8bb2ab8..656bc0ca7a78 100644
@@ -606,8 +606,10 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc)
 				    CEPH_OSD_OP_WRITE, CEPH_OSD_FLAG_WRITE, snapc,

fs/ceph/addr.c static int writepage_nounlock(struct page *page, struct writeback_control *wbc) · line 615

Quoted 10 lines
fs/ceph/addr.c +3 -1
 				    ceph_wbc.truncate_seq, ceph_wbc.truncate_size,
 				    true);
-	if (IS_ERR(req))
+	if (IS_ERR(req)) {
+		redirty_page_for_writepage(wbc, page);
 		return PTR_ERR(req);
+	}
 
 	set_page_writeback(page);
 	if (caching)