Skip to content

Commit aac173e

Browse files
David Jefferymartinkpetersen
authored andcommitted
scsi: vmw_pvscsi: return SUCCESS for successful command aborts
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. [mkp: bumped driver version per request] Signed-off-by: David Jeffery <djeffery@redhat.com> Reviewed-by: Laurence Oberman <loberman@redhat.com> Reviewed-by: Ewan D. Milne <emilne@redhat.com> Acked-by: Jim Gill <jgill@vmware.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 6d3a56e commit aac173e

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/scsi/vmw_pvscsi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,6 +793,7 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
793793
unsigned long flags;
794794
int result = SUCCESS;
795795
DECLARE_COMPLETION_ONSTACK(abort_cmp);
796+
int done;
796797

797798
scmd_printk(KERN_DEBUG, cmd, "task abort on host %u, %p\n",
798799
adapter->host->host_no, cmd);
@@ -824,10 +825,10 @@ static int pvscsi_abort(struct scsi_cmnd *cmd)
824825
pvscsi_abort_cmd(adapter, ctx);
825826
spin_unlock_irqrestore(&adapter->hw_lock, flags);
826827
/* Wait for 2 secs for the completion. */
827-
wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
828+
done = wait_for_completion_timeout(&abort_cmp, msecs_to_jiffies(2000));
828829
spin_lock_irqsave(&adapter->hw_lock, flags);
829830

830-
if (!completion_done(&abort_cmp)) {
831+
if (!done) {
831832
/*
832833
* Failed to abort the command, unmark the fact that it
833834
* was requested to be aborted.

drivers/scsi/vmw_pvscsi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
#include <linux/types.h>
2828

29-
#define PVSCSI_DRIVER_VERSION_STRING "1.0.6.0-k"
29+
#define PVSCSI_DRIVER_VERSION_STRING "1.0.7.0-k"
3030

3131
#define PVSCSI_MAX_NUM_SG_ENTRIES_PER_SEGMENT 128
3232

0 commit comments

Comments
 (0)