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

[xen staging] tools/xenstored: close socket connections on error



commit cd09c4929e9b70d77747ec187ea94731c8a06ab2
Author:     Manuel Bouyer <bouyer@xxxxxxxxxx>
AuthorDate: Wed Feb 3 17:54:19 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Feb 4 21:26:41 2021 +0000

    tools/xenstored: close socket connections on error
    
    On error, don't keep socket connection in ignored state but close them.
    When the remote end of a socket is closed, xenstored will flag it as an
    error and switch the connection to ignored. But on some OSes (e.g.
    NetBSD), poll(2) will return only POLLIN in this case, so sockets in ignored
    state will stay open forever in xenstored (and it will loop with CPU 100%
    busy).
    
    Fixes: d2fa370d3ef9 ("tools/xenstore: Preserve bad client until they are 
destroyed")
    Signed-off-by: Manuel Bouyer <bouyer@xxxxxxxxxx>
    Reviewed-by: Juergen Gross <jgross@xxxxxxxx>
    Release-Acked-by: Ian Jackson <iwj@xxxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 1ab6f162cb..0fea598352 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -1440,6 +1440,9 @@ static void ignore_connection(struct connection *conn)
 
        talloc_free(conn->in);
        conn->in = NULL;
+       /* if this is a socket connection, drop it now */
+       if (conn->fd >= 0)
+               talloc_free(conn);
 }
 
 static const char *sockmsg_string(enum xsd_sockmsg_type type)
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.