Skip to content

Commit dd2922d

Browse files
henryZeKAGA-KOKO
authored andcommitted
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: c8eafe1 ("x86/resctrl: Fix potential lockdep warning") Signed-off-by: Zeng Heng <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 8b68e97 commit dd2922d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/resctrl/rdtgroup.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
536536
goto unlock;
537537
}
538538

539+
rdt_last_cmd_clear();
540+
539541
if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED ||
540542
rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) {
541543
ret = -EINVAL;
@@ -3472,6 +3474,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
34723474
goto out_unlock;
34733475
}
34743476

3477+
rdt_last_cmd_clear();
3478+
34753479
/*
34763480
* Check that the parent directory for a monitor group is a "mon_groups"
34773481
* directory.

0 commit comments

Comments
 (0)