[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 04/20] scsi-disk: Fix assertion failure on WRITE SAME
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 04/20] scsi-disk: Fix assertion failure on WRITE SAME |
Date: |
Wed, 12 Aug 2015 15:36:57 +0200 |
From: Fam Zheng <address@hidden>
The last portion of an unaligned WRITE SAME command could fail the
assertion in bdrv_aligned_pwritev:
assert(!qiov || bytes == qiov->size);
Because we updated data->iov.iov_len right above this if block, but
data->qiov still has the old size.
Reinitialize the qiov to make them equal and keep block layer happy.
Cc: address@hidden
Signed-off-by: Fam Zheng <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/scsi/scsi-disk.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 73fed3f..087541d 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -1683,6 +1683,10 @@ static void scsi_write_same_complete(void *opaque, int
ret)
if (data->iov.iov_len) {
block_acct_start(blk_get_stats(s->qdev.conf.blk), &r->acct,
data->iov.iov_len, BLOCK_ACCT_WRITE);
+ /* blk_aio_write doesn't like the qiov size being different from
+ * nb_sectors, make sure they match.
+ */
+ qemu_iovec_init_external(&data->qiov, &data->iov, 1);
r->req.aiocb = blk_aio_writev(s->qdev.conf.blk, data->sector,
&data->qiov, data->iov.iov_len / 512,
scsi_write_same_complete, data);
--
2.4.3
- [Qemu-devel] [PULL 00/20] SCSI, build, TCG, RCU, misc patches for 2015-08-12, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 03/20] tests: virtio-scsi: clear unit attention after reset, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 02/20] scsi-disk: fix cmd.mode field typo, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 01/20] virtio-scsi: use virtqueue_map_sg() when loading requests, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 04/20] scsi-disk: Fix assertion failure on WRITE SAME,
Paolo Bonzini <=
- [Qemu-devel] [PULL 05/20] virtio-scsi-test: Add test case for tail unaligned WRITE SAME, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 06/20] vhost/scsi: call vhost_dev_cleanup() at unrealize() time, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 08/20] cpu_defs: Simplify CPUTLB padding logic, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 09/20] configure: Default to enable module build, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 07/20] cpu-exec: Do not invalidate original TB in cpu_exec_nocache(), Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 10/20] exec: drop cpu_can_do_io, just read cpu->can_do_io, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 11/20] rcu: Allow calling rcu_(un)register_thread() during synchronize_rcu(), Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 12/20] exec: use macro ROUND_UP for alignment, Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 14/20] qemu-nbd: remove unnecessary qemu_notify_event(), Paolo Bonzini, 2015/08/12
- [Qemu-devel] [PULL 15/20] configure: only add CONFIG_RDMA to config-host.h once, Paolo Bonzini, 2015/08/12