Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280959 > unrolled thread

cpuset: return -EINVAL for legacy non-subset child creation attempt

Started byMike Galbraith <efault@gmx.de>
First post2015-12-01 16:30 +0100
Last post2015-12-02 04:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  cpuset: return -EINVAL for legacy non-subset child creation attempt Mike Galbraith <efault@gmx.de> - 2015-12-01 16:30 +0100
    Re: cpuset: return -EINVAL for legacy non-subset child creation  attempt Zefan Li <lizefan@huawei.com> - 2015-12-02 02:30 +0100
      Re: cpuset: return -EINVAL for legacy non-subset child creation  attempt Mike Galbraith <efault@gmx.de> - 2015-12-02 04:30 +0100

#1280959 — cpuset: return -EINVAL for legacy non-subset child creation attempt

FromMike Galbraith <efault@gmx.de>
Date2015-12-01 16:30 +0100
Subjectcpuset: return -EINVAL for legacy non-subset child creation attempt
Message-ID<qAV2q-2WT-17@gated-at.bofh.it>
A legacy hierarchy child set that is not a subset of its parent is not
a permissions issue, it's an invalid configuration.  Return -EINVAL.

Signed-off-by: Mike Galbraith <efault@gmx.de>
---
 kernel/cpuset.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -472,7 +472,7 @@ static int validate_change(struct cpuset
 	par = parent_cs(cur);
 
 	/* On legacy hiearchy, we must be a subset of our parent cpuset. */
-	ret = -EACCES;
+	ret = -EINVAL;
 	if (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
 	    !is_cpuset_subset(trial, par))
 		goto out;
@@ -481,7 +481,6 @@ static int validate_change(struct cpuset
 	 * If either I or some sibling (!= me) is exclusive, we can't
 	 * overlap
 	 */
-	ret = -EINVAL;
 	cpuset_for_each_child(c, css, par) {
 		if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&
 		    c != cur &&


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1281391 — Re: cpuset: return -EINVAL for legacy non-subset child creation attempt

FromZefan Li <lizefan@huawei.com>
Date2015-12-02 02:30 +0100
SubjectRe: cpuset: return -EINVAL for legacy non-subset child creation attempt
Message-ID<qB4p3-ui-5@gated-at.bofh.it>
In reply to#1280959
On 2015/12/1 23:22, Mike Galbraith wrote:
> A legacy hierarchy child set that is not a subset of its parent is not
> a permissions issue, it's an invalid configuration.  Return -EINVAL.
>

It's sometimes arguable which errno should be used. In this case I don't
see why we can't use EACCES. It's even documented in man page.

        EACCES Attempted to add, using write(2), a CPU  or  memory  node  to  a
               cpuset, when that CPU or memory node was not already in its par-
               ent.

Let's see another example. In mmap manual:

	EACCES A  file descriptor refers to a non-regular file.

We can argue fd of a non-regular file is an invalid configuration, but
here we return EACCES.

> Signed-off-by: Mike Galbraith <efault@gmx.de>
> ---
>   kernel/cpuset.c |    3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -472,7 +472,7 @@ static int validate_change(struct cpuset
>   	par = parent_cs(cur);
>
>   	/* On legacy hiearchy, we must be a subset of our parent cpuset. */
> -	ret = -EACCES;
> +	ret = -EINVAL;
>   	if (!cgroup_subsys_on_dfl(cpuset_cgrp_subsys) &&
>   	    !is_cpuset_subset(trial, par))
>   		goto out;
> @@ -481,7 +481,6 @@ static int validate_change(struct cpuset
>   	 * If either I or some sibling (!= me) is exclusive, we can't
>   	 * overlap
>   	 */
> -	ret = -EINVAL;
>   	cpuset_for_each_child(c, css, par) {
>   		if ((is_cpu_exclusive(trial) || is_cpu_exclusive(c)) &&
>   		    c != cur &&
>
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1281432 — Re: cpuset: return -EINVAL for legacy non-subset child creation attempt

FromMike Galbraith <efault@gmx.de>
Date2015-12-02 04:30 +0100
SubjectRe: cpuset: return -EINVAL for legacy non-subset child creation attempt
Message-ID<qB6hb-1Ij-1@gated-at.bofh.it>
In reply to#1281391
On Wed, 2015-12-02 at 09:20 +0800, Zefan Li wrote:
> On 2015/12/1 23:22, Mike Galbraith wrote:
> > A legacy hierarchy child set that is not a subset of its parent is not
> > a permissions issue, it's an invalid configuration.  Return -EINVAL.
> >
> 
> It's sometimes arguable which errno should be used. In this case I don't
> see why we can't use EACCES. It's even documented in man page.
> 
>         EACCES Attempted to add, using write(2), a CPU  or  memory  node  to  a
>                cpuset, when that CPU or memory node was not already in its par-
>                ent.
> 
> Let's see another example. In mmap manual:
> 
> 	EACCES A  file descriptor refers to a non-regular file.
> 
> We can argue fd of a non-regular file is an invalid configuration, but
> here we return EACCES.

Ok, works for me (official -ENOPE -> gripee), thanks.

	-Mike

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web