From: Kouya Shimura <kouya@jp.fujitsu.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] xend: fix open file descriptor leak
Date: Thu, 20 Jan 2011 13:24:12 +0900 [thread overview]
Message-ID: <7kbp3cdwy5.fsf@jp.fujitsu.com> (raw)
[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 153 bytes --]
I got the following error:
$ xm pci-list-assignable-devices
Error: [Errno 24] Too many open files
Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
[-- Attachment #2: xend_fd_leak.patch --]
[-- Type: text/x-patch, Size: 907 bytes --]
diff -r d1631540bcc4 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py Tue Jan 18 17:23:24 2011 +0000
+++ b/tools/python/xen/util/pci.py Thu Jan 20 13:08:11 2011 +0900
@@ -922,10 +922,12 @@ class PciDevice:
pos = PCI_CAPABILITY_LIST
try:
+ fd = None
fd = os.open(path, os.O_RDONLY)
os.lseek(fd, PCI_STATUS, 0)
status = struct.unpack('H', os.read(fd, 2))[0]
if (status & 0x10) == 0:
+ os.close(fd)
# The device doesn't support PCI_STATUS_CAP_LIST
return 0
@@ -952,6 +954,8 @@ class PciDevice:
os.close(fd)
except OSError, (errno, strerr):
+ if fd is not None:
+ os.close(fd)
raise PciDeviceParseError(('Error when accessing sysfs: %s (%d)' %
(strerr, errno)))
return pos
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
next reply other threads:[~2011-01-20 4:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 4:24 Kouya Shimura [this message]
2011-01-20 16:41 ` [PATCH] xend: fix open file descriptor leak Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7kbp3cdwy5.fsf@jp.fujitsu.com \
--to=kouya@jp.fujitsu.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.