Skip to contentSkip to conversation

netfs: Fix the netfs_folio tracepoint to handle NULL mapping

PATCH New exkc 1 participant 1 message Oct 2, 2024

Subsystems (3)
lore
Share & tools
lore

exkc

author
#0 lore raw

PATCH 1/1 netfs: Fix the netfs_folio tracepoint to handle NULL mapping

From: David Howells <[email protected]>

Fix the netfs_folio tracepoint to handle folios that have a NULL mapping pointer. In such a case, just substitute a zero inode number.

Fixes c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write")
cc Jeff Layton <[email protected]>
---
 include/trace/events/netfs.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
include/trace/events/netfs.h +2 -1
index 76bd42a96815..1d7c52821e55 100644
@@ -448,7 +448,8 @@ TRACE_EVENT(netfs_folio,
 			     ),
 
 	    TP_fast_assign(
-		    __entry->ino = folio->mapping->host->i_ino;
+		    struct address_space *__m = READ_ONCE(folio->mapping);
+		    __entry->ino = __m ? __m->host->i_ino : 0;
 		    __entry->why = why;
 		    __entry->index = folio_index(folio);
 		    __entry->nr = folio_nr_pages(folio);
Signature · 1 line
2.46.1