Linux cgroups development
 help / color / mirror / Atom feed
* [PATCH] cgroup/cpuset: Fix update_prstate() always returning 0 on partition errors
@ 2026-06-02  4:36 Tao Cui
  2026-06-02  4:49 ` Tao Cui
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Cui @ 2026-06-02  4:36 UTC (permalink / raw)
  To: longman, chenridong, tj, hannes, mkoutny, cgroups
  Cc: linux-kernel, Tao Cui, Claude Opus 4 . 7

From: Tao Cui <cuitao@kylinos.cn>

update_prstate() stores the error code in cs->prs_err and transitions
the partition to an invalid state, but always returns 0. The caller
cpuset_partition_write() uses "return retval ?: nbytes", so the write
syscall always appears to succeed from userspace even when the partition
became invalid. Return -EINVAL when err is set so userspace can detect
the failure immediately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---
 kernel/cgroup/cpuset.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
index 591e3aa487fc..8605b4da610e 100644
--- a/kernel/cgroup/cpuset.c
+++ b/kernel/cgroup/cpuset.c
@@ -2965,7 +2965,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
 	if (force_sd_rebuild)
 		rebuild_sched_domains_locked();
 	free_tmpmasks(&tmpmask);
-	return 0;
+	return err ? -EINVAL : 0;
 }
 
 static struct cpuset *cpuset_attach_old_cs;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cgroup/cpuset: Fix update_prstate() always returning 0 on partition errors
  2026-06-02  4:36 [PATCH] cgroup/cpuset: Fix update_prstate() always returning 0 on partition errors Tao Cui
@ 2026-06-02  4:49 ` Tao Cui
  0 siblings, 0 replies; 2+ messages in thread
From: Tao Cui @ 2026-06-02  4:49 UTC (permalink / raw)
  To: longman, chenridong, tj, hannes, mkoutny, cgroups
  Cc: cui.tao, linux-kernel, Tao Cui, Claude Opus 4 . 7

Kindly disregard this patch. 
The issue is fixed by AI auto-testing without Signed-off-by; the tag will be included in v2.

在 2026/6/2 12:36, Tao Cui 写道:
> From: Tao Cui <cuitao@kylinos.cn>
> 
> update_prstate() stores the error code in cs->prs_err and transitions
> the partition to an invalid state, but always returns 0. The caller
> cpuset_partition_write() uses "return retval ?: nbytes", so the write
> syscall always appears to succeed from userspace even when the partition
> became invalid. Return -EINVAL when err is set so userspace can detect
> the failure immediately.
> 
> Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
> ---
>  kernel/cgroup/cpuset.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index 591e3aa487fc..8605b4da610e 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2965,7 +2965,7 @@ static int update_prstate(struct cpuset *cs, int new_prs)
>  	if (force_sd_rebuild)
>  		rebuild_sched_domains_locked();
>  	free_tmpmasks(&tmpmask);
> -	return 0;
> +	return err ? -EINVAL : 0;
>  }
>  
>  static struct cpuset *cpuset_attach_old_cs;


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-02  4:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02  4:36 [PATCH] cgroup/cpuset: Fix update_prstate() always returning 0 on partition errors Tao Cui
2026-06-02  4:49 ` Tao Cui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox