From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian.Jackson@eu.citrix.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH 1/3] xen: handle backend deletion from xenstore
Date: Tue, 24 Apr 2012 14:08:47 +0100 [thread overview]
Message-ID: <1335272929-22967-1-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1204241404180.26786@kaball-desktop>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
hw/xen_backend.c | 17 +++++++++--------
hw/xen_disk.c | 4 ++++
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index 64dc93a..11e09fc 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -561,7 +561,7 @@ static void xenstore_update_be(char *watch, char *type, int dom,
struct XenDevOps *ops)
{
struct XenDevice *xendev;
- char path[XEN_BUFSIZE], *dom0;
+ char path[XEN_BUFSIZE], *dom0, *bepath;
unsigned int len, dev;
dom0 = xs_get_domain_path(xenstore, 0);
@@ -577,15 +577,16 @@ static void xenstore_update_be(char *watch, char *type, int dom,
if (dev == -1)
return;
- if (0) {
- /* FIXME: detect devices being deleted from xenstore ... */
- xen_be_del_xendev(dom, dev);
- }
-
xendev = xen_be_get_xendev(type, dom, dev, ops);
if (xendev != NULL) {
- xen_be_backend_changed(xendev, path);
- xen_be_check_state(xendev);
+ bepath = xs_read(xenstore, 0, xendev->be, &len);
+ if (bepath == NULL) {
+ xen_be_del_xendev(dom, dev);
+ } else {
+ free(bepath);
+ xen_be_backend_changed(xendev, path);
+ xen_be_check_state(xendev);
+ }
}
}
diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 5db58ac..f9ef062 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -758,6 +758,10 @@ static int blk_free(struct XenDevice *xendev)
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
struct ioreq *ioreq;
+ if (blkdev->bs || blkdev->sring) {
+ blk_disconnect(xendev);
+ }
+
while (!LIST_EMPTY(&blkdev->freelist)) {
ioreq = LIST_FIRST(&blkdev->freelist);
LIST_REMOVE(ioreq, list);
--
1.7.2.5
next prev parent reply other threads:[~2012-04-24 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 13:07 [PATCH 0/3] qemu-xen-traditional: xen_disk backports Stefano Stabellini
2012-04-24 13:08 ` Stefano Stabellini [this message]
2012-04-24 13:08 ` [PATCH 2/3] xen_disk: use bdrv_aio_flush instead of bdrv_flush Stefano Stabellini
2012-04-24 13:08 ` [PATCH 3/3] xen_disk: implement BLKIF_OP_FLUSH_DISKCACHE, remove BLKIF_OP_WRITE_BARRIER Stefano Stabellini
2012-04-24 15:53 ` [PATCH 0/3] qemu-xen-traditional: xen_disk backports Ian Jackson
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=1335272929-22967-1-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/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).