]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xen-blkback: sync I/O after backend disconnected
authorJoe Jin <joe.jin@oracle.com>
Mon, 15 Aug 2011 04:55:02 +0000 (12:55 +0800)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 15 Aug 2011 13:13:41 +0000 (09:13 -0400)
When backend disconnects, sync IO requests to the disk.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/block/xen-blkback/xenbus.c

index 7be3d0fe8ad385d3b5b69ab7696a5f14122e8fce..64f63765557a4f6520d92456d4a1dd75843b9abd 100644 (file)
@@ -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)