@@ -1406,6 +1406,7 @@ static int remote_partition_enable(struct cpuset *cs, int new_prs,
14061406 list_add (& cs -> remote_sibling , & remote_children );
14071407 spin_unlock_irq (& callback_lock );
14081408 update_unbound_workqueue_cpumask (isolcpus_updated );
1409+ cs -> prs_err = 0 ;
14091410
14101411 /*
14111412 * Propagate changes in top_cpuset's effective_cpus down the hierarchy.
@@ -1436,9 +1437,11 @@ static void remote_partition_disable(struct cpuset *cs, struct tmpmasks *tmp)
14361437 list_del_init (& cs -> remote_sibling );
14371438 isolcpus_updated = partition_xcpus_del (cs -> partition_root_state ,
14381439 NULL , tmp -> new_cpus );
1439- cs -> partition_root_state = - cs -> partition_root_state ;
1440- if (!cs -> prs_err )
1441- cs -> prs_err = PERR_INVCPUS ;
1440+ if (cs -> prs_err )
1441+ cs -> partition_root_state = - cs -> partition_root_state ;
1442+ else
1443+ cs -> partition_root_state = PRS_MEMBER ;
1444+
14421445 reset_partition_data (cs );
14431446 spin_unlock_irq (& callback_lock );
14441447 update_unbound_workqueue_cpumask (isolcpus_updated );
@@ -1471,8 +1474,10 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *newmask,
14711474
14721475 WARN_ON_ONCE (!cpumask_subset (cs -> effective_xcpus , subpartitions_cpus ));
14731476
1474- if (cpumask_empty (newmask ))
1477+ if (cpumask_empty (newmask )) {
1478+ cs -> prs_err = PERR_CPUSEMPTY ;
14751479 goto invalidate ;
1480+ }
14761481
14771482 adding = cpumask_andnot (tmp -> addmask , newmask , cs -> effective_xcpus );
14781483 deleting = cpumask_andnot (tmp -> delmask , cs -> effective_xcpus , newmask );
@@ -1482,10 +1487,15 @@ static void remote_cpus_update(struct cpuset *cs, struct cpumask *newmask,
14821487 * not allocated to other partitions and there are effective_cpus
14831488 * left in the top cpuset.
14841489 */
1485- if (adding && (!capable (CAP_SYS_ADMIN ) ||
1486- cpumask_intersects (tmp -> addmask , subpartitions_cpus ) ||
1487- cpumask_subset (top_cpuset .effective_cpus , tmp -> addmask )))
1488- goto invalidate ;
1490+ if (adding ) {
1491+ if (!capable (CAP_SYS_ADMIN ))
1492+ cs -> prs_err = PERR_ACCESS ;
1493+ else if (cpumask_intersects (tmp -> addmask , subpartitions_cpus ) ||
1494+ cpumask_subset (top_cpuset .effective_cpus , tmp -> addmask ))
1495+ cs -> prs_err = PERR_NOCPUS ;
1496+ if (cs -> prs_err )
1497+ goto invalidate ;
1498+ }
14891499
14901500 spin_lock_irq (& callback_lock );
14911501 if (adding )
@@ -1601,7 +1611,7 @@ static bool prstate_housekeeping_conflict(int prstate, struct cpumask *new_cpus)
16011611 * The partcmd_update command is used by update_cpumasks_hier() with newmask
16021612 * NULL and update_cpumask() with newmask set. The partcmd_invalidate is used
16031613 * by update_cpumask() with NULL newmask. In both cases, the callers won't
1604- * check for error and so partition_root_state and prs_error will be updated
1614+ * check for error and so partition_root_state and prs_err will be updated
16051615 * directly.
16061616 */
16071617static int update_parent_effective_cpumask (struct cpuset * cs , int cmd ,
@@ -3739,6 +3749,7 @@ static void cpuset_hotplug_update_tasks(struct cpuset *cs, struct tmpmasks *tmp)
37393749
37403750 if (remote && cpumask_empty (& new_cpus ) &&
37413751 partition_is_populated (cs , NULL )) {
3752+ cs -> prs_err = PERR_HOTPLUG ;
37423753 remote_partition_disable (cs , tmp );
37433754 compute_effective_cpumask (& new_cpus , cs , parent );
37443755 remote = false;
0 commit comments