diff mbox series

[15/28] scsi: iscsi: Fix completion check during abort races

Message ID 20210523175739.360324-16-michael.christie@oracle.com
State New
Headers show
Series [01/28] scsi: iscsi: Add task completion helper | expand

Commit Message

Mike Christie May 23, 2021, 5:57 p.m. UTC
We have a ref to the task being aborted, so SCp.ptr will never be NULL. We
need to use iscsi_task_is_completed to check for the completed state.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/libiscsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lee Duncan May 24, 2021, 6:38 p.m. UTC | #1
On 5/23/21 10:57 AM, Mike Christie wrote:
> We have a ref to the task being aborted, so SCp.ptr will never be NULL. We

> need to use iscsi_task_is_completed to check for the completed state.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> ---

>  drivers/scsi/libiscsi.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c

> index 94abb093098d..8222db4f8fef 100644

> --- a/drivers/scsi/libiscsi.c

> +++ b/drivers/scsi/libiscsi.c

> @@ -2338,7 +2338,7 @@ int iscsi_eh_abort(struct scsi_cmnd *sc)

>  		iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST);

>  		goto failed_unlocked;

>  	case TMF_NOT_FOUND:

> -		if (!sc->SCp.ptr) {

> +		if (iscsi_task_is_completed(task)) {

>  			session->tmf_state = TMF_INITIAL;

>  			memset(hdr, 0, sizeof(*hdr));

>  			/* task completed before tmf abort response */

> 


Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 94abb093098d..8222db4f8fef 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -2338,7 +2338,7 @@  int iscsi_eh_abort(struct scsi_cmnd *sc)
 		iscsi_conn_failure(conn, ISCSI_ERR_SCSI_EH_SESSION_RST);
 		goto failed_unlocked;
 	case TMF_NOT_FOUND:
-		if (!sc->SCp.ptr) {
+		if (iscsi_task_is_completed(task)) {
 			session->tmf_state = TMF_INITIAL;
 			memset(hdr, 0, sizeof(*hdr));
 			/* task completed before tmf abort response */