mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
Commitfc2b57c9a("xenstored: send an evtchn notification on introduce_domain") introduced the sending of an event channel to the guest when first introduced, so that dom0less domains waiting for the connection would know that xenstore was ready to use. Unfortunately, it was introduced in introduce_domain(), which 1) is called by other functions, where such functionality is unneeded, and 2) after the main XS_INTRODUCE call, calls domain_conn_reset(). This introduces a race condition, whereby if xenstored is delayed, a domain can wake up, send messages to the buffer, only to have them deleted by xenstore before finishing its processing of the XS_INTRODUCE message. Move the connect-and-notfy call into do_introduce() instead, after the domain_conn_rest(); predicated on the state being in the XENSTORE_RECONNECT state. (We don't need to check for "restoring", since that value is always passed as "false" from do_domain_introduce()). Also take the opportunity to add a missing wmb barrier after resetting the indexes of the ring in domain_conn_reset. This change will also remove an extra event channel notification for dom0 (because the notification is now done by do_introduce which is not called for dom0.) The extra dom0 event channel notification was only introduced byfc2b57c9aand was never present before. It is not needed because dom0 is the one to tell xenstored the connection parameters, so dom0 has to know that the ring page is setup correctly by the time xenstored starts looking at it. It is dom0 that performs the ring page init. Signed-off-by: George Dunlap <george.dunlap@cloud.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com> Reviewed-by: Juergen Gross <jgross@suse.com> master commit:e58bd71c09master date: 2023-10-17 13:56:55 -0700
The following files are imported from the Samba project. We use the versions from Samba 3, the current stable branch. talloc.c: samba-trunk/source/lib/talloc.c r14291 2006-03-13 04:27:47 +0000 talloc.h: samba-trunk/source/include/talloc.h r11986 2005-12-01 00:43:36 +0000