Commit c74ff750 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jason Gunthorpe

Revert "IB/srp: Avoid that a cable pull can trigger a kernel crash"

The caller of srp_ib_lookup_path() is responsible for holding a reference
on the SCSI host. That means that commit 8a0d18c6 was not necessary.
Hence revert it.
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent e68088e7
...@@ -765,19 +765,12 @@ static void srp_path_rec_completion(int status, ...@@ -765,19 +765,12 @@ static void srp_path_rec_completion(int status,
static int srp_ib_lookup_path(struct srp_rdma_ch *ch) static int srp_ib_lookup_path(struct srp_rdma_ch *ch)
{ {
struct srp_target_port *target = ch->target; struct srp_target_port *target = ch->target;
int ret = -ENODEV; int ret;
ch->ib_cm.path.numb_path = 1; ch->ib_cm.path.numb_path = 1;
init_completion(&ch->done); init_completion(&ch->done);
/*
* Avoid that the SCSI host can be removed by srp_remove_target()
* before srp_path_rec_completion() is called.
*/
if (!scsi_host_get(target->scsi_host))
goto out;
ch->ib_cm.path_query_id = ib_sa_path_rec_get(&srp_sa_client, ch->ib_cm.path_query_id = ib_sa_path_rec_get(&srp_sa_client,
target->srp_host->srp_dev->dev, target->srp_host->srp_dev->dev,
target->srp_host->port, target->srp_host->port,
...@@ -791,27 +784,21 @@ static int srp_ib_lookup_path(struct srp_rdma_ch *ch) ...@@ -791,27 +784,21 @@ static int srp_ib_lookup_path(struct srp_rdma_ch *ch)
GFP_KERNEL, GFP_KERNEL,
srp_path_rec_completion, srp_path_rec_completion,
ch, &ch->ib_cm.path_query); ch, &ch->ib_cm.path_query);
ret = ch->ib_cm.path_query_id; if (ch->ib_cm.path_query_id < 0)
if (ret < 0) return ch->ib_cm.path_query_id;
goto put;
ret = wait_for_completion_interruptible(&ch->done); ret = wait_for_completion_interruptible(&ch->done);
if (ret < 0) if (ret < 0)
goto put; return ret;
ret = ch->status; if (ch->status < 0)
if (ret < 0)
shost_printk(KERN_WARNING, target->scsi_host, shost_printk(KERN_WARNING, target->scsi_host,
PFX "Path record query failed: sgid %pI6, dgid %pI6, pkey %#04x, service_id %#16llx\n", PFX "Path record query failed: sgid %pI6, dgid %pI6, pkey %#04x, service_id %#16llx\n",
ch->ib_cm.path.sgid.raw, ch->ib_cm.path.dgid.raw, ch->ib_cm.path.sgid.raw, ch->ib_cm.path.dgid.raw,
be16_to_cpu(target->ib_cm.pkey), be16_to_cpu(target->ib_cm.pkey),
be64_to_cpu(target->ib_cm.service_id)); be64_to_cpu(target->ib_cm.service_id));
put: return ch->status;
scsi_host_put(target->scsi_host);
out:
return ret;
} }
static int srp_rdma_lookup_path(struct srp_rdma_ch *ch) static int srp_rdma_lookup_path(struct srp_rdma_ch *ch)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment