block: Don't emulate natively supported pwritev flags
authorKevin Wolf <kwolf@redhat.com>
Tue, 7 Jun 2016 13:51:28 +0000 (15:51 +0200)
committerKevin Wolf <kwolf@redhat.com>
Wed, 8 Jun 2016 08:21:09 +0000 (10:21 +0200)
Drivers that implement .bdrv_co_pwritev() get the flags passed as an
argument to said function, but we also unconditionally emulate the flags
anyway. We shouldn't do that.

Fix this by clearing all flags that the driver supports natively after
it returns from .bdrv_co_pwritev().

Fixes: 4df863f3 ('block: Make supported_write_flags a per-bds property')
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/io.c

index 9dc265b34dfc85f50989887936f827991fecf047..fb99a7151c4047af27d57788e203af74af48e4f1 100644 (file)
@@ -816,7 +816,9 @@ static int coroutine_fn bdrv_driver_pwritev(BlockDriverState *bs,
     int ret;
 
     if (drv->bdrv_co_pwritev) {
-        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov, flags);
+        ret = drv->bdrv_co_pwritev(bs, offset, bytes, qiov,
+                                   flags & bs->supported_write_flags);
+        flags &= ~bs->supported_write_flags;
         goto emulate_flags;
     }