Skip to contentSkip to conversation

erofs: fix crash when enable tracepoint cachefiles_prep_read

PATCH Applied Xin Yin 4 participants 4 messages May 27, 2022 – May 29, 2022 EROFS file system

lore
Share & tools
lore

Xin Yin

author
#0 lore raw

PATCH 1/1 erofs: fix crash when enable tracepoint cachefiles_prep_read

RIP: 0010:trace_event_raw_event_cachefiles_prep_read+0x88/0xe0
[cachefiles]
Call Trace:
  <TASK>
  cachefiles_prepare_read+0x1d7/0x3a0 [cachefiles]
  erofs_fscache_read_folios+0x188/0x220 [erofs]
  erofs_fscache_meta_readpage+0x106/0x160 [erofs]
  do_read_cache_folio+0x42a/0x590
  ? bdi_register_va.part.14+0x1a7/0x210
  ? super_setup_bdi_name+0x76/0xe0
  erofs_bread+0x5b/0x170 [erofs]
  erofs_fc_fill_super+0x12b/0xc50 [erofs]

This tracepoint uses rreq->inode, should set it when allocating.

Fixes d435d53228dd ("erofs: change to use asynchronous io for fscache

readpage/readahead")

---
 fs/erofs/fscache.c | 1 +
 1 file changed, 1 insertion(+)
fs/erofs/fscache.c +1 -0
index a5cc4ed2cd0d..8e01d89c3319 100644
@@ -17,6 +17,7 @@ static struct netfs_io_request *erofs_fscache_alloc_request(struct address_space
 	rreq->start	= start;
 	rreq->len	= len;
 	rreq->mapping	= mapping;
+	rreq->inode	= mapping->host;
 	INIT_LIST_HEAD(&rreq->subrequests);
 	refcount_set(&rreq->ref, 1);
 	return rreq;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw

Hi, thanks for catching this.

Quoted 13 lines · Xin Yin
RIP: 0010:trace_event_raw_event_cachefiles_prep_read+0x88/0xe0
[cachefiles]
Call Trace:
  <TASK>
  cachefiles_prepare_read+0x1d7/0x3a0 [cachefiles]
  erofs_fscache_read_folios+0x188/0x220 [erofs]
  erofs_fscache_meta_readpage+0x106/0x160 [erofs]
  do_read_cache_folio+0x42a/0x590
  ? bdi_register_va.part.14+0x1a7/0x210
  ? super_setup_bdi_name+0x76/0xe0
  erofs_bread+0x5b/0x170 [erofs]
  erofs_fc_fill_super+0x12b/0xc50 [erofs]
Quoted 4 lines

This tracepoint uses rreq->inode, should set it when allocating.

Fixes d435d53228dd ("erofs: change to use asynchronous io for fscache

readpage/readahead")

The "Fixes" line should better be one single line. But no worry, I think Gao Xiang will fix this then :)

Quoted 10 lines
---
 fs/erofs/fscache.c | 1 +
 1 file changed, 1 insertion(+)
fs/erofs/fscache.c +0 -0
index a5cc4ed2cd0d..8e01d89c3319 100644

fs/erofs/fscache.c static struct netfs_io_request *erofs_fscache_alloc_request(struct address_space · line 23

Quoted 7 lines
fs/erofs/fscache.c +1 -0
@@ -17,6 +17,7 @@ static struct netfs_io_request *erofs_fscache_alloc_request(struct address_space
 	rreq->start	= start;
 	rreq->len	= len;
 	rreq->mapping	= mapping;
+	rreq->inode	= mapping->host;
 	INIT_LIST_HEAD(&rreq->subrequests);
 	refcount_set(&rreq->ref, 1);
 	return rreq;

Otherwise, LGTM.

Signature · 2 lines
Thanks,
Jeffle
maintainer Applied
#2 lore raw
Quoted 17 lines · JeffleXu

Hi, thanks for catching this.

Quoted 13 lines · Xin Yin
RIP: 0010:trace_event_raw_event_cachefiles_prep_read+0x88/0xe0
[cachefiles]
Call Trace:
  <TASK>
  cachefiles_prepare_read+0x1d7/0x3a0 [cachefiles]
  erofs_fscache_read_folios+0x188/0x220 [erofs]
  erofs_fscache_meta_readpage+0x106/0x160 [erofs]
  do_read_cache_folio+0x42a/0x590
  ? bdi_register_va.part.14+0x1a7/0x210
  ? super_setup_bdi_name+0x76/0xe0
  erofs_bread+0x5b/0x170 [erofs]
  erofs_fc_fill_super+0x12b/0xc50 [erofs]
Quoted 7 lines
Quoted 4 lines

This tracepoint uses rreq->inode, should set it when allocating.

Fixes d435d53228dd ("erofs: change to use asynchronous io for fscache

readpage/readahead")

The "Fixes" line should better be one single line. But no worry, I think Gao Xiang will fix this then :)

Yeah,

Quoted 21 lines
Quoted 11 lines
---
 fs/erofs/fscache.c | 1 +
 1 file changed, 1 insertion(+)
fs/erofs/fscache.c +0 -0
index a5cc4ed2cd0d..8e01d89c3319 100644

fs/erofs/fscache.c static struct netfs_io_request *erofs_fscache_alloc_request(struct address_space · line 23

Quoted 7 lines
fs/erofs/fscache.c +1 -0
@@ -17,6 +17,7 @@ static struct netfs_io_request *erofs_fscache_alloc_request(struct address_space
 	rreq->start	= start;
 	rreq->len	= len;
 	rreq->mapping	= mapping;
+	rreq->inode	= mapping->host;
 	INIT_LIST_HEAD(&rreq->subrequests);
 	refcount_set(&rreq->ref, 1);
 	return rreq;

Otherwise, LGTM.

Quoted 2 lines

Thanks, applied.

Thanks,
Gao Xiang

Quoted 3 lines
Signature · 2 lines
Thanks,
Jeffle
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Xin Yin
Quoted 13 lines · Xin Yin
RIP: 0010:trace_event_raw_event_cachefiles_prep_read+0x88/0xe0
[cachefiles]
Call Trace:
   <TASK>
   cachefiles_prepare_read+0x1d7/0x3a0 [cachefiles]
   erofs_fscache_read_folios+0x188/0x220 [erofs]
   erofs_fscache_meta_readpage+0x106/0x160 [erofs]
   do_read_cache_folio+0x42a/0x590
   ? bdi_register_va.part.14+0x1a7/0x210
   ? super_setup_bdi_name+0x76/0xe0
   erofs_bread+0x5b/0x170 [erofs]
   erofs_fc_fill_super+0x12b/0xc50 [erofs]
Quoted 4 lines

This tracepoint uses rreq->inode, should set it when allocating.

Fixes d435d53228dd ("erofs: change to use asynchronous io for fscache

readpage/readahead")

Should not wrap long 'fixes' line.

Quoted 1 line

Thanks,