xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Fatih Acar <fatih.acar@gandi.net>
Subject: [PATCH 2/2] xl: disable events earlier for shutdown event
Date: Thu, 2 Feb 2017 15:46:37 +0000	[thread overview]
Message-ID: <20170202154637.1478-3-wei.liu2@citrix.com> (raw)
In-Reply-To: <20170202154637.1478-1-wei.liu2@citrix.com>

We need to disable event machinery when the guest shuts down.  It
doesn't really matter where we disable it as long as it is within the
branch for shutdown event.

Move the code snippet before handle_domain_death, so that d_config is
not yet updated and we have the correct ->num_disks. And the free diskws
and set it to NULL, so that diskws gets automatically set up again when
xl goes over the domain creation code path.

Reported-by: Fatih Acar <fatih.acar@gandi.net>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Fatih Acar <fatih.acar@gandi.net>

Fatih, please test this series to see if it fixes your issue.

Ian, backport candidate?
---
 tools/libxl/xl_cmdimpl.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 9bf10dfcb2..7df6db1ec9 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -3137,6 +3137,11 @@ start:
             LOG("Domain %u has shut down, reason code %d 0x%x", domid,
                 event->u.domain_shutdown.shutdown_reason,
                 event->u.domain_shutdown.shutdown_reason);
+            libxl_evdisable_domain_death(ctx, deathw);
+            deathw = NULL;
+            evdisable_disk_ejects(diskws, d_config.num_disks);
+            free(diskws);
+            diskws = NULL;
             switch (handle_domain_death(&domid, event, &d_config)) {
             case DOMAIN_RESTART_SOFT_RESET:
                 domid_soft_reset = domid;
@@ -3154,9 +3159,6 @@ start:
                 /* Otherwise fall through and restart. */
             case DOMAIN_RESTART_NORMAL:
                 libxl_event_free(ctx, event);
-                libxl_evdisable_domain_death(ctx, deathw);
-                deathw = NULL;
-                evdisable_disk_ejects(diskws, d_config.num_disks);
                 /* discard any other events which may have been generated */
                 while (!(ret = libxl_event_check(ctx, &event,
                                                  LIBXL_EVENTMASK_ALL, 0,0))) {
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-02-02 15:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 15:46 [PATCH 0/2] xl: event machinery fixes Wei Liu
2017-02-02 15:46 ` [PATCH 1/2] xl: free event in DOMAIN_RESTART_RENAME error path Wei Liu
2017-02-02 16:22   ` Wei Liu
2017-02-03 11:57   ` Ian Jackson
2017-02-02 15:46 ` Wei Liu [this message]
2017-02-02 15:52   ` [PATCH 2/2] xl: disable events earlier for shutdown event Ian Jackson
2017-02-02 16:00     ` Wei Liu
2017-02-02 16:05       ` Ian Jackson
2017-02-02 16:22         ` Wei Liu
2017-02-02 16:24           ` Ian Jackson
2017-02-03  9:46           ` Fatih Acar
2017-02-03 11:08             ` Wei Liu
2017-02-03 12:06 ` [PATCH 0/2] xl: event machinery fixes Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170202154637.1478-3-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=fatih.acar@gandi.net \
    --cc=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).