]> git.proxmox.com Git - mirror_lxcfs.git/commitdiff
cgroups: handle non-existent isolcpus file
authorChristian Brauner <christian.brauner@canonical.com>
Tue, 22 Nov 2016 00:20:01 +0000 (01:20 +0100)
committerChristian Brauner <christian.brauner@canonical.com>
Tue, 22 Nov 2016 00:23:41 +0000 (01:23 +0100)
If the file "/sys/devices/system/cpu/isolated" doesn't exist, we can't just
simply bail. We still need to check whether we need to copy the parents cpu
settings.

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
pam/pam_cgfs.c

index cf7a9c5d28c5e2b8e59332fb791e6e58fefa0830..6553afa104326082c32aae2fdb8de72e5fac9a59 100644 (file)
@@ -1798,6 +1798,24 @@ static bool cg_filter_and_set_cpus(char *path, bool am_initialized)
        if (maxposs < 0)
                goto on_error;
 
+       if (!file_exists(__ISOL_CPUS)) {
+               /* This system doesn't expose isolated cpus. */
+               lxcfs_debug("%s", "Path: "__ISOL_CPUS" to read isolated cpus from does not exist.\n");
+               cpulist = posscpus;
+               /* No isolated cpus but we weren't already initialized by
+                * someone. We should simply copy the parents cpuset.cpus
+                * values.
+                */
+               if (!am_initialized) {
+                       lxcfs_debug("%s", "Copying cpuset of parent cgroup.\n");
+                       goto copy_parent;
+               }
+               /* No isolated cpus but we were already initialized by someone.
+                * Nothing more to do for us.
+                */
+               goto on_success;
+       }
+
        isolcpus = read_file(__ISOL_CPUS);
        if (!isolcpus) {
                lxcfs_debug("%s", "Could not read file "__ISOL_CPUS"\n");