Pass the live_update bool to stubdom_init() in order to be able to
handle it properly under Mini-OS.
As stubdom_init() will (re-)create the 9pfs device needed for
reading the saved state, call stubdom_init() before lu_read_state().
Signed-off-by: Juergen Gross <jgross@suse.com>
---
tools/xenstored/core.c | 4 ++--
tools/xenstored/core.h | 2 +-
tools/xenstored/domain.c | 15 +++++++++------
tools/xenstored/domain.h | 2 +-
tools/xenstored/minios.c | 12 +++++++++---
5 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/tools/xenstored/core.c b/tools/xenstored/core.c
index 09c838d6e8..18c5643029 100644
--- a/tools/xenstored/core.c
+++ b/tools/xenstored/core.c
@@ -2770,14 +2770,14 @@ int main(int argc, char *argv[])
if (tracefile)
tracefile = absolute_filename(NULL, tracefile);
+ stubdom_init(live_update);
+
#ifndef NO_LIVE_UPDATE
/* Read state in case of live update. */
if (live_update)
lu_read_state();
#endif
- stubdom_init();
-
check_store();
/* Get ready to listen to the tools. */
diff --git a/tools/xenstored/core.h b/tools/xenstored/core.h
index 3f7426fbe3..5071f1dedd 100644
--- a/tools/xenstored/core.h
+++ b/tools/xenstored/core.h
@@ -412,7 +412,7 @@ xenevtchn_handle *evtchn_fdopen(int fd);
int evtchn_rebind(int port);
#ifdef __MINIOS__
-void mount_9pfs(void);
+void mount_9pfs(bool live_update);
#endif
const char *xenstore_rundir(void);
diff --git a/tools/xenstored/domain.c b/tools/xenstored/domain.c
index ca0744d6bb..877a14e858 100644
--- a/tools/xenstored/domain.c
+++ b/tools/xenstored/domain.c
@@ -1267,7 +1267,7 @@ void dom0_init(void)
xenevtchn_notify(xce_handle, dom0->port);
}
-void stubdom_init(void)
+void stubdom_init(bool live_update)
{
#ifdef __MINIOS__
struct domain *stubdom;
@@ -1275,13 +1275,16 @@ void stubdom_init(void)
if (stub_domid < 0)
return;
- stubdom = introduce_domain(NULL, stub_domid, xenbus_evtchn, false);
- if (!stubdom)
- barf_perror("Failed to initialize stubdom");
+ if (!live_update) {
+ stubdom = introduce_domain(NULL, stub_domid, xenbus_evtchn,
+ false);
+ if (!stubdom)
+ barf_perror("Failed to initialize stubdom");
- xenevtchn_notify(xce_handle, stubdom->port);
+ xenevtchn_notify(xce_handle, stubdom->port);
+ }
- mount_9pfs();
+ mount_9pfs(live_update);
#endif
}
diff --git a/tools/xenstored/domain.h b/tools/xenstored/domain.h
index 844ac11510..02b261ad47 100644
--- a/tools/xenstored/domain.h
+++ b/tools/xenstored/domain.h
@@ -85,7 +85,7 @@ int do_reset_watches(const void *ctx, struct connection *conn,
void domain_early_init(void);
void domain_init(int evtfd);
void dom0_init(void);
-void stubdom_init(void);
+void stubdom_init(bool live_update);
void domain_deinit(void);
void ignore_connection(struct connection *conn, unsigned int err);
diff --git a/tools/xenstored/minios.c b/tools/xenstored/minios.c
index ec5faebaf3..f04423fe09 100644
--- a/tools/xenstored/minios.c
+++ b/tools/xenstored/minios.c
@@ -131,15 +131,21 @@ static void mount_thread(void *p)
free(err);
}
- p9_device = init_9pfront(0, XENSTORE_LIB_DIR);
+ p9_device = init_9pfront2(0, XENSTORE_LIB_DIR, INIT9P_FLAG_KEXEC);
/* Start logging if selected. */
reopen_log();
}
-void mount_9pfs(void)
+void mount_9pfs(bool live_update)
{
- create_thread("mount-9pfs", mount_thread, NULL);
+ if (!live_update)
+ create_thread("mount-9pfs", mount_thread, NULL);
+ else {
+ p9_device = init_9pfront2(0, XENSTORE_LIB_DIR,
+ INIT9P_FLAG_REINIT);
+ reopen_log();
+ }
}
const char *xenstore_rundir(void)
--
2.43.0