Merge tag 'erofs-for-5.16-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs
Pull erofs fix from Gao Xiang: "Fix an ABBA deadlock introduced by XArray conversion" * tag 'erofs-for-5.16-rc3-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs: erofs: fix deadlock when shrink erofs slab
This commit is contained in:
@@ -150,7 +150,7 @@ static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
|
||||
* however in order to avoid some race conditions, add a
|
||||
* DBG_BUGON to observe this in advance.
|
||||
*/
|
||||
DBG_BUGON(xa_erase(&sbi->managed_pslots, grp->index) != grp);
|
||||
DBG_BUGON(__xa_erase(&sbi->managed_pslots, grp->index) != grp);
|
||||
|
||||
/* last refcount should be connected with its managed pslot. */
|
||||
erofs_workgroup_unfreeze(grp, 0);
|
||||
@@ -165,15 +165,19 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
|
||||
unsigned int freed = 0;
|
||||
unsigned long index;
|
||||
|
||||
xa_lock(&sbi->managed_pslots);
|
||||
xa_for_each(&sbi->managed_pslots, index, grp) {
|
||||
/* try to shrink each valid workgroup */
|
||||
if (!erofs_try_to_release_workgroup(sbi, grp))
|
||||
continue;
|
||||
xa_unlock(&sbi->managed_pslots);
|
||||
|
||||
++freed;
|
||||
if (!--nr_shrink)
|
||||
break;
|
||||
return freed;
|
||||
xa_lock(&sbi->managed_pslots);
|
||||
}
|
||||
xa_unlock(&sbi->managed_pslots);
|
||||
return freed;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user