public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: David Jeffery <djeffery@redhat.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH] vmw_pvscsi: return SUCCESS for successful command aborts
Date: Fri, 28 Oct 2016 13:24:44 -0400	[thread overview]
Message-ID: <1477675484.17595.47.camel@localhost.localdomain> (raw)
In-Reply-To: <20161028162726.GA1270@rage>

On Fri, 2016-10-28 at 12:27 -0400, David Jeffery wrote:
> The vmw_pvscsi driver reports most successful aborts as FAILED to the scsi
> error handler.  This is do to a misunderstanding of how completion_done() works
> and its interaction with a successful wait using wait_for_completion_timeout().
> The vmw_pvscsi driver is expecting completion_done() to always return true if
> complete() has been called on the completion structure.  But completion_done()
> returns true after complete() has been called only if no function like
> wait_for_completion_timeout() has seen the completion and cleared it as part of
> successfully waiting for the completion.
> 
> Instead of using completion_done(), vmw_pvscsi should just use the return
> value from wait_for_completion_timeout() to know if the wait timed out or not.
> 
> Signed-off-by: David Jeffery <djeffery@redhat.com>
> 
> ---
>  vmw_pvscsi.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- a/drivers/scsi/vmw_pvscsi.c
> +++ b/drivers/scsi/vmw_pvscsi.c
> @@ -793,6 +793,7 @@ static int pvscsi_abort(struct scsi_cmnd
>  	unsigned long flags;
>  	int result = SUCCESS;
>  	DECLARE_COMPLETION_ONSTACK(abort_cmp);
> +	int done;
>  
>  	scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n",
>  		    adapter->host->host_no, cmd);
> @@ -824,10 +825,10 @@ static int pvscsi_abort(struct scsi_cmnd
>  	pvscsi_abort_cmd(adapter, ctx);
>  	spin_unlock_irqrestore(&adapter->hw_lock, flags);
>  	/* Wait for 2 secs for the completion. */
> -	wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
> +	done = wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
>  	spin_lock_irqsave(&adapter->hw_lock, flags);
>  
> -	if (!completion_done(&abort_cmp)) {
> +	if (!done) {
>  		/*
>  		 * Failed to abort the command, unmark the fact that it
>  		 * was requested to be aborted.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reviewed-by: Ewan D. Milne <emilne@redhat.com>



  parent reply	other threads:[~2016-10-28 17:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 16:27 [PATCH] vmw_pvscsi: return SUCCESS for successful command aborts David Jeffery
2016-10-28 17:05 ` Laurence Oberman
2016-10-28 17:24 ` Ewan D. Milne [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-10-31 22:04 Jim Gill
2016-11-01 13:54 ` Martin K. Petersen

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=1477675484.17595.47.camel@localhost.localdomain \
    --to=emilne@redhat.com \
    --cc=djeffery@redhat.com \
    --cc=linux-scsi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox