]> xenbits.xensource.com Git - libvirt.git/commit
qemu: Handle huge number of queues correctly
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 2 Sep 2013 14:06:14 +0000 (16:06 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 3 Sep 2013 11:38:35 +0000 (13:38 +0200)
commit1dc5dea7d605d3b02c64940fc3566a7765dce3c3
treefa0a0125400583d230a1924d1852167d5a15a8d2
parent418137663f1ca0877a176b996ac027d89747fe90
qemu: Handle huge number of queues correctly

Currently, kernel supports up to 8 queues for a multiqueue tap device.
However, if user tries to enter a huge number (e.g. one million) the tap
allocation fails, as expected. But what is not expected is the log full
of warnings:

    warning : virFileClose:83 : Tried to close invalid fd 0

The problem is, upon error we iterate over an array of FDs (handlers to
queues) and VIR_FORCE_CLOSE() over each item. However, the array is
pre-filled with zeros. Hence, we repeatedly close stdin. Ouch.
But there's more. The queues allocation is done in virNetDevTapCreate()
which cleans up the FDs in case of error. Then, its caller, the
virNetDevTapCreateInBridgePort() iterates over the FD array and tries to
close them too. And so does qemuNetworkIfaceConnect() and
qemuBuildInterfaceCommandLine().
src/qemu/qemu_command.c
src/util/virnetdevtap.c