Reorder rdt_kill_sb() to prevent rmid parsing errors caused by premature cdp_enabled reset. The rmid to reqpartid conversion depends on cdp_enabled state, but rdt_disable_ctx() clears this flag. Delay rdt_disable_ctx() until after rmdir_all_sub() completes, ensuring free_rmid() operates with correct CDP state. Additionally, flush all pending limbo work before umount completes. This prevents rmid release errors on subsequent mounts if CDP state changes between mount sessions. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/rdtgroup.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 5da305bd36c9..62e57a939cb7 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3165,6 +3165,25 @@ static void resctrl_fs_teardown(void) rdtgroup_destroy_root(); } +static void rdt_destroy_limbo(void) +{ + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3); + struct rdt_l3_mon_domain *d; + + if (!IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) + return; + + if (!resctrl_is_mon_event_enabled(QOS_L3_OCCUP_EVENT_ID)) + return; + + list_for_each_entry(d, &r->mon_domains, hdr.list) { + if (has_busy_rmid(d)) { + __check_limbo(d, true); + cancel_delayed_work(&d->cqm_limbo); + } + } +} + static void rdt_kill_sb(struct super_block *sb) { struct rdt_resource *r; @@ -3172,13 +3191,14 @@ static void rdt_kill_sb(struct super_block *sb) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - rdt_disable_ctx(); - /* Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) resctrl_arch_reset_all_ctrls(r); resctrl_fs_teardown(); + rdt_destroy_limbo(); + rdt_disable_ctx(); + if (resctrl_arch_alloc_capable()) resctrl_arch_disable_alloc(); if (resctrl_arch_mon_capable()) -- 2.25.1