xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Joe Jin <joe.jin@oracle.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jens Axboe <jaxboe@fusionio.com>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Kurt C Hackel <KURT.HACKEL@oracle.com>,
	Greg Marsden <greg.marsden@oracle.com>,
	Joe Jin <joe.jin@oracle.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [patch] xen-blkback: sync I/O after backend disconnected
Date: Mon, 15 Aug 2011 12:55:02 +0800	[thread overview]
Message-ID: <4E48A6A6.4040706@oracle.com> (raw)

When backend disconnect, sync IO requests to the disk.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
---
 drivers/block/xen-blkback/xenbus.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 1a87f5b..da39d61 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -35,6 +35,7 @@ static void connect(struct backend_info *);
 static int connect_ring(struct backend_info *);
 static void backend_changed(struct xenbus_watch *, const char **,
 			    unsigned int);
+static void xen_vbd_sync(struct xen_vbd *vbd);
 
 struct xenbus_device *xen_blkbk_xenbus(struct backend_info *be)
 {
@@ -232,6 +233,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif)
 		free_vm_area(blkif->blk_ring_area);
 		blkif->blk_rings.common.sring = NULL;
 	}
+	xen_vbd_sync(&blkif->vbd);
 }
 
 void xen_blkif_free(struct xen_blkif *blkif)
@@ -332,6 +334,12 @@ static void xen_vbd_free(struct xen_vbd *vbd)
 	vbd->bdev = NULL;
 }
 
+static void xen_vbd_sync(struct xen_vbd *vbd)
+{
+	if (vbd->bdev)
+		fsync_bdev(vbd->bdev);
+}
+
 static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle,
 			  unsigned major, unsigned minor, int readonly,
 			  int cdrom)

             reply	other threads:[~2011-08-15  4:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-15  4:55 Joe Jin [this message]
2011-08-15 14:46 ` [patch] xen-blkback: sync I/O after backend disconnected Christoph Hellwig
2011-08-15 15:10   ` [Xen-devel] " Konrad Rzeszutek Wilk
2011-08-16  6:56   ` Joe Jin
2011-08-22 14:38     ` Christoph Hellwig
     [not found]   ` <m2n.s.1QsyrJ-132485@chiark.greenend.org.uk>
2011-08-25 16:15     ` [Xen-devel] " Ian Jackson
2011-09-07 12:48       ` Konrad Rzeszutek Wilk

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=4E48A6A6.4040706@oracle.com \
    --to=joe.jin@oracle.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=KURT.HACKEL@oracle.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;
as well as URLs for NNTP newsgroup(s).