Commit ee12d6a8 authored by Bart Van Assche's avatar Bart Van Assche Committed by Roland Dreier

IB/srp: Introduce the helper function srp_remove_target()

Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Acked-by: default avatarDavid Dillow <dillowda@ornl.gov>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 294c875a
...@@ -506,6 +506,17 @@ static void srp_del_scsi_host_attr(struct Scsi_Host *shost) ...@@ -506,6 +506,17 @@ static void srp_del_scsi_host_attr(struct Scsi_Host *shost)
device_remove_file(&shost->shost_dev, *attr); device_remove_file(&shost->shost_dev, *attr);
} }
static void srp_remove_target(struct srp_target_port *target)
{
srp_del_scsi_host_attr(target->scsi_host);
srp_remove_host(target->scsi_host);
scsi_remove_host(target->scsi_host);
ib_destroy_cm_id(target->cm_id);
srp_free_target_ib(target);
srp_free_req_data(target);
scsi_host_put(target->scsi_host);
}
static void srp_remove_work(struct work_struct *work) static void srp_remove_work(struct work_struct *work)
{ {
struct srp_target_port *target = struct srp_target_port *target =
...@@ -518,13 +529,7 @@ static void srp_remove_work(struct work_struct *work) ...@@ -518,13 +529,7 @@ static void srp_remove_work(struct work_struct *work)
list_del(&target->list); list_del(&target->list);
spin_unlock(&target->srp_host->target_lock); spin_unlock(&target->srp_host->target_lock);
srp_del_scsi_host_attr(target->scsi_host); srp_remove_target(target);
srp_remove_host(target->scsi_host);
scsi_remove_host(target->scsi_host);
ib_destroy_cm_id(target->cm_id);
srp_free_target_ib(target);
srp_free_req_data(target);
scsi_host_put(target->scsi_host);
} }
static int srp_connect_target(struct srp_target_port *target) static int srp_connect_target(struct srp_target_port *target)
......
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