Re: [PATCH v2] Ensure client streams are closed when marking a client for close

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/15/2011 11:15 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange"<berrange@xxxxxxxxxx>

NB, previous patch was borked due to bad rebase

Every active stream results in a reference being held on the
virNetServerClientPtr object. This meant that if a client quit
with any streams active, although all I/O was stopped the
virNetServerClientPtr object would leak. This causes libvirtd
to leak any file handles associated with open streams when a
client quit

To fix this, when we call virNetServerClientClose there is a
callback invoked which lets the daemon release the streams
and thus the extra references

* daemon/remote.c: Add a hook to close all streams
* daemon/stream.c, daemon/stream.h: Add API for releasing
   all streams
* src/rpc/virnetserverclient.c, src/rpc/virnetserverclient.h:
   Allow registration of a hook to trigger when closing client
---
  daemon/remote.c              |   11 ++++++++++-
  daemon/stream.c              |   38 ++++++++++++++++++++++++++++++++------
  daemon/stream.h              |    3 +++
  src/rpc/virnetserverclient.c |   21 +++++++++++++++++++++
  src/rpc/virnetserverclient.h |    5 +++++
  5 files changed, 71 insertions(+), 7 deletions(-)

+void
+daemonRemoveAllClientStreams(daemonClientStream *stream)
+{
+    daemonClientStream *tmp;
+
+    VIR_DEBUG("stream=%p", stream);
+
+    while (stream) {
+        tmp = stream->next;
+
+        if (!stream->closed) {
+            virStreamEventRemoveCallback(stream->st);
+            virStreamAbort(stream->st);
+        }
+
+        daemonFreeClientStream(NULL, stream);
+
+        VIR_DEBUG("next stream=%p", stream);
+        stream = tmp;

Is that the right VIR_DEBUG message, or should it be:

VIR_DEBUG("next stream=%p", tmp);

ACK with that fixed.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]