scsi-disk: Fix assertion failure on WRITE SAME
commitf399ea092ea46c82b819ba1fdbcb082eb8019a32
authorFam Zheng <famz@redhat.com>
Wed, 29 Jul 2015 08:45:11 +0000 (29 16:45 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Sat, 17 Oct 2015 23:03:09 +0000 (17 18:03 -0500)
tree8f433e6bfc5909b1c2e80eb2046057a63b1b52fe
parent83c92b45140be773f0c5545dddea35a89db1ad03
scsi-disk: Fix assertion failure on WRITE SAME

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: qemu-stable@nongnu.org
Signed-off-by: Fam Zheng <famz@redhat.com>
Message-Id: <1438159512-3871-2-git-send-email-famz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit a56537a12757a8cdee24ad8c83e5af7a9833ea70)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/scsi/scsi-disk.c