Skip to contentSkip to conversation

netfs: clear PG_private_2 on copy-to-cache append failure

PATCH In review Yichong Chen 2 participants 3 messages Jul 4 – Jul 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfs: clear PG_private_2 on copy-to-cache append failure

netfs_pgpriv2_copy_to_cache() marks the folio with PG_private_2 before netfs_pgpriv2_copy_folio() appends it to the copy-to-cache rolling buffer.

If the append fails, the folio is not queued for cache writeback, so the PG_private_2 state and its reference must be released immediately.

---
 fs/netfs/read_pgpriv2.c | 1 +
 1 file changed, 1 insertion(+)
fs/netfs/read_pgpriv2.c +1 -0
index a1489aa29f78..7eacc58abadb 100644
@@ -54,6 +54,7 @@ static void netfs_pgpriv2_copy_folio(struct netfs_io_request *creq, struct folio
 
 	/* Attach the folio to the rolling buffer. */
 	if (rolling_buffer_append(&creq->buffer, folio, 0) < 0) {
+		folio_end_private_2(folio);
 		clear_bit(NETFS_RREQ_FOLIO_COPY_TO_CACHE, &creq->flags);
 		return;
 	}
Signature · 1 line
2.51.0
#1 lore raw

Hi,

Ping. Any comments on this patch?

Thanks,
Yichong

#2 lore raw
Quoted 3 lines · Yichong Chen

Hi,

Ping. Any comments on this patch?

David will pick it up and include it in his next round of fixes and then I'll pick it up.