diff mbox

threads scsi_eh_ and scsi_tmf_ don't die when ib_srp reconnect

Message ID 55CB796D.3030709@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche Aug. 12, 2015, 4:50 p.m. UTC
On 08/11/2015 10:15 PM, Konstantin Krotov wrote:
> 11.08.2015 23:28, Bart Van Assche ?????:
>> Are you using a kernel from Greg KH's stable repository or another kernel ? And to which values were the
> yes, sources from upstream, 3.19.1

Hello Konstantin,

Can you test the patch below ? That patch not only applies to the v4.2-rc6
kernel but also to the ib_srp-backport driver.

Thanks,

Bart.

Subject: [PATCH] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails

scsi_host_alloc() not only allocates memory for a SCSI host but also
creates the scsi_eh_<n> kernel thread and the scsi_tmf_<n> workqueue.
Stop these threads if login fails by calling scsi_host_put().

Reported-by: Konstantin Krotov <kkv@clodo.ru>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: stable <stable@vger.kernel.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Konstantin Krotov Aug. 14, 2015, 9:06 a.m. UTC | #1
12.08.2015 19:50, Bart Van Assche ?????:
> On 08/11/2015 10:15 PM, Konstantin Krotov wrote:
>> 11.08.2015 23:28, Bart Van Assche ?????:
>>> Are you using a kernel from Greg KH's stable repository or another kernel ? And to which values were the
>> yes, sources from upstream, 3.19.1
>
> Hello Konstantin,
>
> Can you test the patch below ? That patch not only applies to the v4.2-rc6
> kernel but also to the ib_srp-backport driver.
>
> Thanks,
>
> Bart.
>
> Subject: [PATCH] IB/srp: Stop the scsi_eh_<n> and scsi_tmf_<n> threads if login fails
>
> scsi_host_alloc() not only allocates memory for a SCSI host but also
> creates the scsi_eh_<n> kernel thread and the scsi_tmf_<n> workqueue.
> Stop these threads if login fails by calling scsi_host_put().
>
> Reported-by: Konstantin Krotov <kkv@clodo.ru>
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: stable <stable@vger.kernel.org>
> ---
>   drivers/infiniband/ulp/srp/ib_srp.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index f962267..b5f9456 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -2765,6 +2765,13 @@ static int srp_sdev_count(struct Scsi_Host *host)
>   	return c;
>   }
>
> +/*
> + * Return values:
> + * < 0 upon failure. Caller is responsible for SRP target port cleanup.
> + * 0 and target->state == SRP_TARGET_REMOVED if the target port will be removed
> + *    asynchronously.
> + * 0 and target->state != SRP_TARGET_REMOVED upon success.
> + */
>   static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
>   {
>   	struct srp_rport_identifiers ids;
> @@ -3316,6 +3323,7 @@ err_disconnect:
>   	}
>
>   	kfree(target->ch);
> +	scsi_host_put(target->scsi_host);
>   	goto out;
>   }
>
>
Hello Bart

I tested the patch, the problem is not reproduced.

Thanks.
Bart Van Assche Aug. 14, 2015, 4:10 p.m. UTC | #2
On 08/14/2015 02:06 AM, Konstantin Krotov wrote:
> I tested the patch, the problem is not reproduced.

Thanks for confirming that the patch fixes this issue. I will send a 
slightly modified version of this patch soon to the Linux RDMA maintainer.

Bart.
--
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
diff mbox

Patch

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index f962267..b5f9456 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -2765,6 +2765,13 @@  static int srp_sdev_count(struct Scsi_Host *host)
 	return c;
 }
 
+/*
+ * Return values:
+ * < 0 upon failure. Caller is responsible for SRP target port cleanup.
+ * 0 and target->state == SRP_TARGET_REMOVED if the target port will be removed
+ *    asynchronously.
+ * 0 and target->state != SRP_TARGET_REMOVED upon success.
+ */
 static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
 {
 	struct srp_rport_identifiers ids;
@@ -3316,6 +3323,7 @@  err_disconnect:
 	}
 
 	kfree(target->ch);
+	scsi_host_put(target->scsi_host);
 	goto out;
 }