From: Joe Jin <joe.jin@oracle.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Jens Axboe <jaxboe@fusionio.com>,
Daniel Stodden <daniel.stodden@citrix.com>,
Annie Li <annie.li@oracle.com>,
Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Greg Marsden <greg.marsden@oracle.com>,
Kurt C Hackel <KURT.HACKEL@oracle.com>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Joe Jin <joe.jin@oracle.com>
Subject: [PATCH] xen-blkback: Don't disconnect backend until state switched to XenbusStateClosed.
Date: Mon, 15 Aug 2011 12:51:31 +0800 [thread overview]
Message-ID: <4E48A5D3.6020501@oracle.com> (raw)
When do block-attach/block-detach test with below steps, umount hang
in guest. Also shutdown ends up being stuck when umounting filesystems.
1. start guest.
2. attach new block device by xm block-attach in Dom0.
3. mount new disk in guest.
4. execute xm block-detach to detach the block device in dom0 until timeout
5. Any request to the disk will hung.
Root cause:
This issue caused by when setting backend device's state to
'XenbusStateClosing', which will send frontend XenbusStateClosing
notification. When frontend receives the notification it tries to release
the disk by blkfront_closing(), but at that moment, the disk is still in use
by guest, so frontend refuses to close.
In blkfront_closing(), it sets the disk state to XenbusStateClosing and send
a state switch to Closing notification to backend, when backend received the
event, it disconnect the vbd from real device, set the vbd device state to
XenbusStateClosing. For backend disconnected from real device/file, any IO
requests to the disk in guest will end up, leaving disk DEAD disk and set to
"XenbusStateClosing". For the disk have been disconnected, umount will hang
on blkif_release()->xlvbd_release_gendisk() for unable send any IO to the
disk, this prevent system clean shutdown.
Solution:
Don't disconnect backend until frontend state switch to XenbusStateClosed.
Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Daniel Stodden <daniel.stodden@citrix.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Annie Li <annie.li@oracle.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
---
drivers/block/xen-blkback/xenbus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 3f129b4..1a87f5b 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -601,11 +601,11 @@ static void frontend_changed(struct xenbus_device *dev,
break;
case XenbusStateClosing:
- xen_blkif_disconnect(be->blkif);
xenbus_switch_state(dev, XenbusStateClosing);
break;
case XenbusStateClosed:
+ xen_blkif_disconnect(be->blkif);
xenbus_switch_state(dev, XenbusStateClosed);
if (xenbus_dev_is_online(dev))
break;
reply other threads:[~2011-08-15 4:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4E48A5D3.6020501@oracle.com \
--to=joe.jin@oracle.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=KURT.HACKEL@oracle.com \
--cc=annie.li@oracle.com \
--cc=daniel.stodden@citrix.com \
--cc=greg.marsden@oracle.com \
--cc=jaxboe@fusionio.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--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