> @@ -789,7 +798,16 @@ static int z_erofs_pcluster_begin(struct > z_erofs_decompress_frontend *fe) > DBG_BUGON(fe->owned_head == Z_EROFS_PCLUSTER_NIL); > > if (!(map->m_flags & EROFS_MAP_META)) { > - grp = erofs_find_workgroup(sb, blknr); > + while (1) { > + rcu_read_lock(); > + grp = xa_load(&EROFS_SB(sb)->managed_pslots, blknr); > + if (erofs_workgroup_get(grp)) { I guess here should be modified as below, please refer to erofs_find_workgroup().
if (grp && erofs_workgroup_get(grp)) { > + DBG_BUGON(blknr != grp->index); > + rcu_read_unlock(); > + break; > + } > + rcu_read_unlock(); > + } > } else if ((map->m_pa & ~PAGE_MASK) + map->m_plen > PAGE_SIZE) { > DBG_BUGON(1); > return -EFSCORRUPTED; > diff --git a/fs/erofs/zutil.c b/fs/erofs/zutil.c > index 37afe2024840..218b0249a482 100644 > --- a/fs/erofs/zutil.c > +++ b/fs/erofs/zutil.c > @@ -214,7 +214,7 @@ void erofs_release_pages(struct page **pagepool) > } > } > > -static bool erofs_workgroup_get(struct erofs_workgroup *grp) > +bool erofs_workgroup_get(struct erofs_workgroup *grp) > { > if (lockref_get_not_zero(&grp->lockref)) > return true; > @@ -231,54 +231,6 @@ static bool erofs_workgroup_get(struct erofs_workgroup > *grp) > return true; > } > > -struct erofs_workgroup *erofs_find_workgroup(struct super_block *sb, > - pgoff_t index) > -{ > - struct erofs_sb_info *sbi = EROFS_SB(sb); > - struct erofs_workgroup *grp; > - > -repeat: > - rcu_read_lock(); > - grp = xa_load(&sbi->managed_pslots, index); > - if (grp) { Please refer to this logic. > - if (!erofs_workgroup_get(grp)) { > - /* prefer to relax rcu read side */ > - rcu_read_unlock(); > - goto repeat; > - } > - > - DBG_BUGON(index != grp->index); > - } > - rcu_read_unlock(); > - return grp; > -} Thanks, Chunhai