]> git.proxmox.com Git - pve-container.git/commitdiff
cgroup: don't dup cgroup.events and don't busy-loop
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 15 May 2020 13:53:22 +0000 (15:53 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 May 2020 14:20:10 +0000 (16:20 +0200)
Events are reported via POLLPRI and POLLERR (priority and
exception flags), not POLLIN (which causes a busy-loop).

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC/CGroup.pm

index 5db1d486b7288d48f2ff2e932b6d7e7652db9a73..d6b27ea07d903518b132c8841a0cd5124f808aad 100644 (file)
@@ -546,18 +546,16 @@ my sub v2_freeze_thaw {
 
     PVE::ProcFSTools::write_proc_entry("$path/cgroup.freeze", $desired_state);
     while (1) {
-       my @handles = $select->can_read();
-       next if !@handles;
-       open(my $dup, '<&', $fh)
-           or die "failed to reopen cgroup.events file: $!\n";
-       seek($dup, 0, 0)
-           or die "failed to rewind cgroup.events file: $!\n";
        my $data = do {
            local $/ = undef;
-           <$dup>
+           <$fh>
        };
        $data = parse_flat_keyed_file($data);
        last if $data->{frozen} == $desired_state;
+       my @handles = $select->has_exception();
+       next if !@handles;
+       seek($fh, 0, 0)
+           or die "failed to rewind cgroup.events file: $!\n";
     }
 }