All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: David Vrabel <david.vrabel@citrix.com>, xen-devel@lists.xenproject.org
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] xen-scsifront: don't deadlock if the ring becomes full
Date: Thu, 11 Sep 2014 15:42:36 +0200	[thread overview]
Message-ID: <5411A6CC.8090708@suse.com> (raw)
In-Reply-To: <1410442313-19639-1-git-send-email-david.vrabel@citrix.com>

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)
>


  reply	other threads:[~2014-09-11 13:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]
2014-09-11 13:42 ` Juergen Gross
  -- strict thread matches above, loose matches on Subject: below --
2014-09-11 13:31 David Vrabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5411A6CC.8090708@suse.com \
    --to=jgross@suse.com \
    --cc=david.vrabel@citrix.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.