]> xenbits.xensource.com Git - xen.git/commitdiff
tools/ocaml/xenstored: fix live update exception
authorEdwin Török <edvin.torok@citrix.com>
Fri, 21 Oct 2022 07:59:25 +0000 (08:59 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Dec 2022 11:04:12 +0000 (11:04 +0000)
During live update we will load the /tool/xenstored path from the previous binary,
and then try to mkdir /tool again which will fail with EEXIST.
Check for existence of the path before creating it.

The write call to /tool/xenstored should not need any changes
(and we do want to overwrite any previous path, in case it changed).

Prior to 7110192b1df6 live update would work only if the binary path was
specified, and with 7110192b1df6 and this live update also works when
no binary path is specified in `xenstore-control live-update`.

Fixes: 7110192b1df6 ("tools/oxenstored: Fix Oxenstored Live Update")
Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
Release-acked-by: Henry Wang <Henry.Wang@arm.com>
(cherry picked from commit f838b956779ff8a0b94636462f3c6d95c3adeb73)

tools/ocaml/xenstored/xenstored.ml

index 3e9f6ce5b2a5342057bbe3d5e2c22f67bd12238b..ffd43a4eee64354f9e41a37df64ecd15baa3b5e5 100644 (file)
@@ -419,7 +419,9 @@ let _ =
        ) in
 
        (* required for xenstore-control to detect availability of live-update *)
-       Store.mkdir store Perms.Connection.full_rights (Store.Path.of_string "/tool");
+       let tool_path = Store.Path.of_string "/tool" in
+       if not (Store.path_exists store tool_path) then
+               Store.mkdir store Perms.Connection.full_rights tool_path;
        Store.write store Perms.Connection.full_rights
                (Store.Path.of_string "/tool/xenstored") Sys.executable_name;