* [PATCH] scsi-generic: fix io_timeout property not applying
@ 2024-03-15 14:58 Lorenz Brun
2024-03-15 16:39 ` Alex Bennée
2024-03-26 10:00 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 3+ messages in thread
From: Lorenz Brun @ 2024-03-15 14:58 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Fam Zheng
The io_timeout property, introduced in c9b6609 (part of 6.0) is
silently overwritten by the hardcoded default value of 30 seconds
(DEFAULT_IO_TIMEOUT) in scsi_generic_realize because that function is
being called after the properties have already been applied.
The property definition already has a default value which is applied
correctly when no value is explicitly set, so we can just remove the
code which overrides the io_timeout completely.
This has been tested by stracing SG_IO operations with the io_timeout
property set and unset and now sets the timeout field in the ioctl
request to the proper value.
Fixes: c9b6609b69facad ("scsi: make io_timeout configurable")
Signed-off-by: Lorenz Brun <lorenz@brun.one>
---
hw/scsi/scsi-generic.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
index b7b04e1d63..ee945f87e3 100644
--- a/hw/scsi/scsi-generic.c
+++ b/hw/scsi/scsi-generic.c
@@ -752,7 +752,6 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
/* Only used by scsi-block, but initialize it nevertheless to be clean. */
s->default_scsi_version = -1;
- s->io_timeout = DEFAULT_IO_TIMEOUT;
scsi_generic_read_device_inquiry(s);
}
--
2.42.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi-generic: fix io_timeout property not applying
2024-03-15 14:58 [PATCH] scsi-generic: fix io_timeout property not applying Lorenz Brun
@ 2024-03-15 16:39 ` Alex Bennée
2024-03-26 10:00 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2024-03-15 16:39 UTC (permalink / raw)
To: Lorenz Brun; +Cc: qemu-devel, Paolo Bonzini, Fam Zheng
Lorenz Brun <lorenz@brun.one> writes:
> The io_timeout property, introduced in c9b6609 (part of 6.0) is
> silently overwritten by the hardcoded default value of 30 seconds
> (DEFAULT_IO_TIMEOUT) in scsi_generic_realize because that function is
> being called after the properties have already been applied.
>
> The property definition already has a default value which is applied
> correctly when no value is explicitly set, so we can just remove the
> code which overrides the io_timeout completely.
>
> This has been tested by stracing SG_IO operations with the io_timeout
> property set and unset and now sets the timeout field in the ioctl
> request to the proper value.
>
> Fixes: c9b6609b69facad ("scsi: make io_timeout configurable")
> Signed-off-by: Lorenz Brun <lorenz@brun.one>
> ---
> hw/scsi/scsi-generic.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c
> index b7b04e1d63..ee945f87e3 100644
> --- a/hw/scsi/scsi-generic.c
> +++ b/hw/scsi/scsi-generic.c
> @@ -752,7 +752,6 @@ static void scsi_generic_realize(SCSIDevice *s, Error **errp)
>
> /* Only used by scsi-block, but initialize it nevertheless to be clean. */
> s->default_scsi_version = -1;
> - s->io_timeout = DEFAULT_IO_TIMEOUT;
> scsi_generic_read_device_inquiry(s);
> }
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi-generic: fix io_timeout property not applying
2024-03-15 14:58 [PATCH] scsi-generic: fix io_timeout property not applying Lorenz Brun
2024-03-15 16:39 ` Alex Bennée
@ 2024-03-26 10:00 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-26 10:00 UTC (permalink / raw)
To: Lorenz Brun, qemu-devel; +Cc: Paolo Bonzini, Fam Zheng
On 15/3/24 15:58, Lorenz Brun wrote:
> The io_timeout property, introduced in c9b6609 (part of 6.0) is
> silently overwritten by the hardcoded default value of 30 seconds
> (DEFAULT_IO_TIMEOUT) in scsi_generic_realize because that function is
> being called after the properties have already been applied.
>
> The property definition already has a default value which is applied
> correctly when no value is explicitly set, so we can just remove the
> code which overrides the io_timeout completely.
>
> This has been tested by stracing SG_IO operations with the io_timeout
> property set and unset and now sets the timeout field in the ioctl
> request to the proper value.
>
> Fixes: c9b6609b69facad ("scsi: make io_timeout configurable")
> Signed-off-by: Lorenz Brun <lorenz@brun.one>
> ---
> hw/scsi/scsi-generic.c | 1 -
> 1 file changed, 1 deletion(-)
Thanks, patch queued.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-26 10:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-15 14:58 [PATCH] scsi-generic: fix io_timeout property not applying Lorenz Brun
2024-03-15 16:39 ` Alex Bennée
2024-03-26 10:00 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).