tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 3841d75a6dcd12d108aaf56560b99431d18169e4 commit: fb4c3a2751ebf142fecc61eea8c738573ec3bf10 [4008/23799] staging: erofs: fix race when the managed cache is enabled config: arm64-randconfig-r133-20240926 (https://download.01.org/0day-ci/archive/20240929/202409290639.uZftDFPU-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce: (https://download.01.org/0day-ci/archive/20240929/202409290639.uZftDFPU-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202409290639.uZftDFPU-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
drivers/staging/erofs/utils.c:138:6: sparse: sparse: symbol 'erofs_try_to_release_workgroup' was not declared. Should it be static?
drivers/staging/erofs/utils.c:138:6: warning: no previous prototype for 'erofs_try_to_release_workgroup' [-Wmissing-prototypes] 138 | bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/erofs_try_to_release_workgroup +138 drivers/staging/erofs/utils.c
137
138 bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
139 struct erofs_workgroup *grp, 140 bool cleanup) 141 { 142 void *entry; 143 144 /* 145 * for managed cache enabled, the refcount of workgroups 146 * themselves could be < 0 (freezed). So there is no guarantee 147 * that all refcount > 0 if managed cache is enabled. 148 */ 149 if (!erofs_workgroup_try_to_freeze(grp, 1)) 150 return false; 151 152 /* 153 * note that all cached pages should be unlinked 154 * before delete it from the radix tree. 155 * Otherwise some cached pages of an orphan old workgroup 156 * could be still linked after the new one is available. 157 */ 158 if (erofs_try_to_free_all_cached_pages(sbi, grp)) { 159 erofs_workgroup_unfreeze(grp, 1); 160 return false; 161 } 162 163 /* 164 * it is impossible to fail after the workgroup is freezed, 165 * however in order to avoid some race conditions, add a 166 * DBG_BUGON to observe this in advance. 167 */ 168 entry = radix_tree_delete(&sbi->workstn_tree, grp->index); 169 DBG_BUGON((void *)((unsigned long)entry & 170 ~RADIX_TREE_EXCEPTIONAL_ENTRY) != grp); 171 172 /* 173 * if managed cache is enable, the last refcount 174 * should indicate the related workstation. 175 */ 176 erofs_workgroup_unfreeze_final(grp); 177 return true; 178 } 179