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

[PATCH v1] tools/hotplug: systemd: Make dependency on Xen device nodes



When system booting up, the kernel module xen_gntdev.ko is loaded and
the device node '/dev/xen/gntdev' is created; later the xenstored
service in systemd launches daemon to open this device node.

This flow has a race condition between creating the device node in the
kernel module and using the device node in the systemd service.  It's
possible that the xenstored service fails to open the device node due
to the delay of creating the device node.  In the end, xenbus cannot be
used between the Dom0 kernel and the Xen hypervisor.

To resolve this issue, we need to synchronize between udev and systemd
for the device node.  There have an extra change in the udev rules for
tagging 'systemd' for Xen device nodes, which notifies device node
creating to systemd; besides udev change, this patch adds dependency in
systemd service for waiting the device node.

Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx>
---

 The udev rules change is on github:
 
https://github.com/systemd/systemd/pull/28962/commits/520340dfea3b6cf9fe7a24c9238313b1a5fe8539

 tools/hotplug/Linux/systemd/xenstored.service.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/hotplug/Linux/systemd/xenstored.service.in 
b/tools/hotplug/Linux/systemd/xenstored.service.in
index 261077dc92..6e48cdb0e7 100644
--- a/tools/hotplug/Linux/systemd/xenstored.service.in
+++ b/tools/hotplug/Linux/systemd/xenstored.service.in
@@ -1,7 +1,7 @@
 [Unit]
 Description=The Xen xenstore
-Requires=proc-xen.mount
-After=proc-xen.mount
+Requires=proc-xen.mount dev-xen-gntdev.device
+After=proc-xen.mount dev-xen-gntdev.device
 Before=libvirtd.service libvirt-guests.service
 RefuseManualStop=true
 ConditionPathExists=/proc/xen/capabilities
-- 
2.39.2




 


Rackspace

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