On 08/05/2015 13:38, Dimitris Aragiorgis wrote: > During migration, QEMU uses fsync()/fdatasync() on the open file > descriptor for read-write block devices to flush data just before > stopping the VM. > > However, fsync() on a scsi-generic device returns -EINVAL which > causes the migration to fail. This patch skips flushing data in case > of an SG device, since submitting SCSI commands directly via an SG > character device (e.g. /dev/sg0) bypasses the page cache completely, > anyway.
Good catch! The patch is correct, but please remove the same test from iscsi_co_flush (in block/iscsi.c) because it's now duplicate. Thanks, Paolo > Signed-off-by: Dimitris Aragiorgis <dim...@arrikto.com> > --- > block/io.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/block/io.c b/block/io.c > index 1ce62c4..d248a4d 100644 > --- a/block/io.c > +++ b/block/io.c > @@ -2231,7 +2231,7 @@ int coroutine_fn bdrv_co_flush(BlockDriverState *bs) > { > int ret; > > - if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs)) { > + if (!bs || !bdrv_is_inserted(bs) || bdrv_is_read_only(bs) || > bdrv_is_sg(bs)) { > return 0; > } > >