kubevirt/0006-isolation-close-file-when-exits.patch
Vasily Ulyanov 7bbce13ae8 Accepting request 1101725 from home:vulyanov:branches:Virtualization
- Support multiple watchdogs in the domain schema
  0005-Support-multiple-watchdogs-in-the-domain-schema.patch
- Fix leaking file descriptor
  0006-isolation-close-file-when-exits.patch
- Fix volume detach on hotplug attachment pod delete
  0007-Fix-volume-detach-on-hotplug-attachment-pod-delete.patch

OBS-URL: https://build.opensuse.org/request/show/1101725
OBS-URL: https://build.opensuse.org/package/show/Virtualization/kubevirt?expand=0&rev=124
2023-08-01 12:23:02 +00:00

32 lines
1.1 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 8ae5fc3c4506c53adc5aae4cd20ad2d9ac4c035a Mon Sep 17 00:00:00 2001
From: grass-lu <284555125@qq.com>
Date: Mon, 24 Jul 2023 15:22:17 +0800
Subject: [PATCH 1/3] isolation: close file when exits
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The file is not closedand the sock connection has not been truly closed, and it occupy connection for libvirtd
Signed-off-by: grass-lu <284555125@qq.com>
---
pkg/virt-handler/isolation/detector.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/pkg/virt-handler/isolation/detector.go b/pkg/virt-handler/isolation/detector.go
index 62f920025..9c282e231 100644
--- a/pkg/virt-handler/isolation/detector.go
+++ b/pkg/virt-handler/isolation/detector.go
@@ -231,6 +231,8 @@ func (s *socketBasedIsolationDetector) getPid(socket string) (int, error) {
if err != nil {
return -1, err
}
+ defer ufile.Close()
+
// This is the tricky part, which will give us the PID of the owning socket
ucreds, err := syscall.GetsockoptUcred(int(ufile.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
if err != nil {
--
2.41.0