mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
scsi: make io_timeout configurable
The current code sets an infinite timeout on SG_IO requests, causing the guest to stall if the host experiences a frame loss. This patch adds an 'io_timeout' parameter for SCSIDevice to make the SG_IO timeout configurable, and also shortens the default timeout to 30 seconds to avoid infinite stalls. Signed-off-by: Hannes Reinecke <hare@suse.de> Message-Id: <20201116183114.55703-3-hare@suse.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
106ad1f9c5
commit
c9b6609b69
3 changed files with 18 additions and 9 deletions
|
@ -2624,7 +2624,7 @@ static int get_device_type(SCSIDiskState *s)
|
|||
cmd[4] = sizeof(buf);
|
||||
|
||||
ret = scsi_SG_IO_FROM_DEV(s->qdev.conf.blk, cmd, sizeof(cmd),
|
||||
buf, sizeof(buf));
|
||||
buf, sizeof(buf), s->qdev.io_timeout);
|
||||
if (ret < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2785,7 +2785,7 @@ static BlockAIOCB *scsi_block_do_sgio(SCSIBlockReq *req,
|
|||
/* The rest is as in scsi-generic.c. */
|
||||
io_header->mx_sb_len = sizeof(r->req.sense);
|
||||
io_header->sbp = r->req.sense;
|
||||
io_header->timeout = UINT_MAX;
|
||||
io_header->timeout = s->qdev.io_timeout * 1000;
|
||||
io_header->usr_ptr = r;
|
||||
io_header->flags |= SG_FLAG_DIRECT_IO;
|
||||
|
||||
|
@ -3103,6 +3103,8 @@ static Property scsi_block_properties[] = {
|
|||
DEFAULT_MAX_IO_SIZE),
|
||||
DEFINE_PROP_INT32("scsi_version", SCSIDiskState, qdev.default_scsi_version,
|
||||
-1),
|
||||
DEFINE_PROP_UINT32("io_timeout", SCSIDiskState, qdev.io_timeout,
|
||||
DEFAULT_IO_TIMEOUT),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue