aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
authorZeng Heng <zengheng4@huawei.com>2025-06-03 20:58:28 +0800
committerThomas Gleixner <tglx@linutronix.de>2025-06-04 20:32:55 +0200
commitdd2922dcfaa3296846265e113309e5f7f138839f (patch)
tree32dd9bee1ad91881ddcb9a0d2572c9f88596d106 /fs
parent8b68e978718f14fdcb080c2a7791c52a0d09bc6d (diff)
downloadlinux-dd2922dcfaa3296846265e113309e5f7f138839f.tar.gz
fs/resctrl: Restore the rdt_last_cmd_clear() calls after acquiring rdtgroup_mutex
A lockdep fix removed two rdt_last_cmd_clear() calls that were used to clear the last_cmd_status buffer but called without holding the required rdtgroup_mutex. The impacted resctrl commands are writing to the cpus or cpus_list files and creating a new monitor or control group. With stale data in the last_cmd_status buffer the impacted resctrl commands report the stale error on success, or append its own failure message to the stale error on failure. Consequently, restore the rdt_last_cmd_clear() calls after acquiring rdtgroup_mutex. Fixes: c8eafe149530 ("x86/resctrl: Fix potential lockdep warning") Signed-off-by: Zeng Heng <zengheng4@huawei.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lore.kernel.org/all/20250603125828.1590067-1-zengheng4@huawei.com
Diffstat (limited to 'fs')
-rw-r--r--fs/resctrl/rdtgroup.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index cc37f58b47dd71..1beb124e25f6f5 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -536,6 +536,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
goto unlock;
}
+ rdt_last_cmd_clear();
+
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED ||
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
ret = -EINVAL;
@@ -3472,6 +3474,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
goto out_unlock;
}
+ rdt_last_cmd_clear();
+
/*
* Check that the parent directory for a monitor group is a "mon_groups"
* directory.