refutationalist / saur

Sam's AUR -- personal Arch packages
4 stars 5 forks source link

xen: Fix race condition in block hotplug script #25

Closed RA-Kooi closed 3 months ago

RA-Kooi commented 3 months ago

The block hotplug script has a race condition where the xenstore entries can be deleted before the script called, or during when the script is run. Store the xenstore entries on disk in case they're not present in xenstore anymore.

refutationalist commented 3 months ago

This patch breaks. It's looking for stuff in /run/xen-hotplug which doesn't exist. Does this need to be paired with another patch?

HVM

# xl create hvm.cfg 
Parsing config from hvm.cfg
libxl: error: libxl_exec.c:117:libxl_report_child_exitstatus: /etc/xen/scripts/block add [712] exited with error status 1
libxl: error: libxl_device.c:1357:device_hotplug_child_death_cb: script: /etc/xen/scripts/block failed; error detected.
libxl: error: libxl_create.c:1713:domcreate_launch_dm: Domain 1:unable to add disk devices
libxl: error: libxl_domain.c:354:libxl_domain_info: Domain 1:Getting domain info: No such process
libxl: error: libxl_domain.c:1214:libxl__destroy_domid: Domain 1:Non-existant domain
libxl: error: libxl_domain.c:1168:domain_destroy_callback: Domain 1:Unable to destroy guest
libxl: error: libxl_domain.c:1095:domain_destroy_cb: Domain 1:Destruction of domain failed

PVH

# xl create -c /etc/xen/noauto/testing/pvh.cfg 
Parsing config from /etc/xen/noauto/testing/pvh.cfg
libxl: error: libxl_exec.c:117:libxl_report_child_exitstatus: /etc/xen/scripts/block add [848] exited with error status 1
libxl: error: libxl_device.c:1357:device_hotplug_child_death_cb: script: /etc/xen/scripts/block failed; error detected.
libxl: error: libxl_create.c:1713:domcreate_launch_dm: Domain 2:unable to add disk devices
libxl: error: libxl_domain.c:354:libxl_domain_info: Domain 2:Getting domain info: No such process
libxl: error: libxl_domain.c:1214:libxl__destroy_domid: Domain 2:Non-existant domain
libxl: error: libxl_domain.c:1168:domain_destroy_callback: Domain 2:Unable to destroy guest
libxl: error: libxl_domain.c:1095:domain_destroy_cb: Domain 2:Destruction of domain failed

xl-pvh.log

Waiting for domain pvh (domid 2) to die [pid 1007]
Domain 2 has shut down, reason code 0 0x0
Action for shutdown reason code 0 is destroy
Domain 2 needs to be cleaned up: destroying the domain
Done. Exiting now

xen-hotplug.log

/etc/xen/scripts/block: line 261: /run/xen-hotplug/backend-vbd-2-51713-params: No such file or directory
cat: /run/xen-hotplug/backend-vbd-2-51713-type: No such file or directory
/etc/xen/scripts/block: line 261: /run/xen-hotplug/backend-vbd-1-768-params: No such file or directory
cat: /run/xen-hotplug/backend-vbd-1-768-type: No such file or directory
/etc/xen/scripts/block: line 261: /run/xen-hotplug/backend-vbd-2-51713-params: No such file or directory
cat: /run/xen-hotplug/backend-vbd-2-51713-type: No such file or directory
RA-Kooi commented 3 months ago

Output of systemctl --failed please. I think the /run/xen-hotplug directory is supposed to be created by either libxl or systemd.

Also please post a config of a failing VM so I can test it on my side.

RA-Kooi commented 3 months ago

There may be a possibility that this patch is not needed anymore. I will have to do some testing.

RA-Kooi commented 3 months ago

After talking to Marek and testing a bit, it seems that this patch is not needed anymore.