* [PATCH] xen-scsifront: don't deadlock if the ring becomes full
@ 2014-09-11 13:31 David Vrabel
2014-09-11 13:42 ` Juergen Gross
0 siblings, 1 reply; 2+ messages in thread
From: David Vrabel @ 2014-09-11 13:31 UTC (permalink / raw)
To: xen-devel; +Cc: David Vrabel, linux-scsi, Juergen Gross
scsifront_action_handler() will deadlock on host->host_lock, if the
ring is full and it has to wait for entries to become available.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
---
This was found with sparse. I've not tested it.
---
drivers/scsi/xen-scsifront.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 7e88659..cc14c8d 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -541,8 +541,9 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)
if (!shadow)
return FAILED;
+ spin_lock_irq(host->host_lock);
+
for (;;) {
- spin_lock_irq(host->host_lock);
if (!RING_FULL(&info->ring)) {
ring_req = scsifront_command2ring(info, sc, shadow);
if (ring_req)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xen-scsifront: don't deadlock if the ring becomes full
2014-09-11 13:31 [PATCH] xen-scsifront: don't deadlock if the ring becomes full David Vrabel
@ 2014-09-11 13:42 ` Juergen Gross
0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2014-09-11 13:42 UTC (permalink / raw)
To: David Vrabel, xen-devel; +Cc: linux-scsi
On 09/11/2014 03:31 PM, David Vrabel wrote:
> scsifront_action_handler() will deadlock on host->host_lock, if the
> ring is full and it has to wait for entries to become available.
>
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
> This was found with sparse. I've not tested it.
Test might be difficult. :-)
Reviewed-by: Juergen Gross <jgross@suse.com>
Thanks for spotting this.
Juergen
> ---
> drivers/scsi/xen-scsifront.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
> index 7e88659..cc14c8d 100644
> --- a/drivers/scsi/xen-scsifront.c
> +++ b/drivers/scsi/xen-scsifront.c
> @@ -541,8 +541,9 @@ static int scsifront_action_handler(struct scsi_cmnd *sc, uint8_t act)
> if (!shadow)
> return FAILED;
>
> + spin_lock_irq(host->host_lock);
> +
> for (;;) {
> - spin_lock_irq(host->host_lock);
> if (!RING_FULL(&info->ring)) {
> ring_req = scsifront_command2ring(info, sc, shadow);
> if (ring_req)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-11 13:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 13:31 [PATCH] xen-scsifront: don't deadlock if the ring becomes full David Vrabel
2014-09-11 13:42 ` Juergen Gross
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).