xen/blkfront: cope with backend that fail empty BLKIF_OP_WRITE_BARRIER requests
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Tue, 2 Nov 2010 15:55:58 +0000 (11:55 -0400)
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Tue, 2 Nov 2010 17:46:46 +0000 (13:46 -0400)
Some(?) Xen block backends fail BLKIF_OP_WRITE_BARRIER requests, which
Linux uses as a cache flush operation.  In that case, disable use
of FLUSH.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: Daniel Stodden <daniel.stodden@citrix.com>
drivers/block/xen-blkfront.c

index 76b874a791758dd4782450d7053ada3f8148263e..4f9e22f29138f1001dfca566ab3b04e176b6ae2e 100644 (file)
@@ -656,6 +656,16 @@ static irqreturn_t blkif_interrupt(int irq, void *dev_id)
                                printk(KERN_WARNING "blkfront: %s: write barrier op failed\n",
                                       info->gd->disk_name);
                                error = -EOPNOTSUPP;
+                       }
+                       if (unlikely(bret->status == BLKIF_RSP_ERROR &&
+                                    info->shadow[id].req.nr_segments == 0)) {
+                               printk(KERN_WARNING "blkfront: %s: empty write barrier op failed\n",
+                                      info->gd->disk_name);
+                               error = -EOPNOTSUPP;
+                       }
+                       if (unlikely(error)) {
+                               if (error == -EOPNOTSUPP)
+                                       error = 0;
                                info->feature_flush = 0;
                                xlvbd_flush(info);
                        }