]> git.baikalelectronics.ru Git - kernel.git/commitdiff
erofs: fix crash when enable tracepoint cachefiles_prep_read
authorXin Yin <yinxin.x@bytedance.com>
Fri, 27 May 2022 10:18:00 +0000 (18:18 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Sun, 29 May 2022 07:36:04 +0000 (15:36 +0800)
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: 3aabb1a1959f ("erofs: change to use asynchronous io for fscache readpage/readahead")
Signed-off-by: Xin Yin <yinxin.x@bytedance.com>
Reviewed-by: Jeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20220527101800.22360-1-yinxin.x@bytedance.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/fscache.c

index 7e4417167d0b412f2289046c7bd951ec618d4928..3552592529438510f9ab300baaa6afd5a3c13b47 100644 (file)
@@ -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;