xen/blkback: Flush blkback data when connecting.
authorChris Lalancette <clalance@redhat.com>
Wed, 21 Jul 2010 19:41:45 +0000 (12:41 -0700)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 14 Apr 2011 22:26:13 +0000 (18:26 -0400)
First cut at flushing blkback data when first connecting
blkback.  This should avoid the pygrub issues we are experiencing
in (RedHat bugzilla) 466681.

[ 2.6.18-xen.hg commit 63b4d7f56688 ]

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
drivers/xen/blkback/xenbus.c

index c31e5c4..a0534fc 100644 (file)
@@ -91,6 +91,13 @@ static void update_blkif_status(blkif_t *blkif)
                return;
        }
 
+       err = filemap_write_and_wait(blkif->vbd.bdev->bd_inode->i_mapping);
+       if (err) {
+               xenbus_dev_error(blkif->be->dev, err, "block flush");
+               return;
+       }
+       invalidate_inode_pages2(blkif->vbd.bdev->bd_inode->i_mapping);
+
        blkif->xenblkd = kthread_run(blkif_schedule, blkif, name);
        if (IS_ERR(blkif->xenblkd)) {
                err = PTR_ERR(blkif->xenblkd);