[openib-general] [PATCHE 02/12] SRP: changing ibsrpdm

Muli Ben-Yehuda muli at il.ibm.com
Mon May 1 06:33:42 PDT 2006


On Mon, May 01, 2006 at 02:25:46PM +0300, Ishai Rabinovitz wrote:
> 
> Move the destruction of the host and the removal from a list to a function.
> 
> Signed-off-by: Ishai Rabinovitz <ishai at mellanox.co.il>
> 
> Index: last_stable/drivers/infiniband/ulp/srp/ib_srp.c
> ===================================================================
> --- last_stable.orig/drivers/infiniband/ulp/srp/ib_srp.c	2006-04-23 14:08:03.000000000 +0300
> +++ last_stable/drivers/infiniband/ulp/srp/ib_srp.c	2006-04-24 10:47:00.000000000 +0300
> @@ -344,6 +344,16 @@ static void srp_disconnect_target(struct
>  	wait_for_completion(&target->done);
>  }
>  
> +static void destruct_scsi_host_and_target(struct srp_target_port *target, int disconnect_target)
> +{
> +	scsi_remove_host(target->scsi_host);
> +	if (disconnect_target)
> +		srp_disconnect_target(target);
> +	ib_destroy_cm_id(target->cm_id);
> +	srp_free_target_ib(target);
> +	scsi_host_put(target->scsi_host);
> +}
> +
>  static void srp_remove_work(void *target_ptr)
>  {
>  	struct srp_target_port *target = target_ptr;
> @@ -357,10 +374,7 @@ static void srp_remove_work(void *target
> 	list_del(&target->list);
> 	mutex_unlock(&target->srp_host->target_mutex);
>  
> -	scsi_remove_host(target->scsi_host);
> -	ib_destroy_cm_id(target->cm_id);
> -	srp_free_target_ib(target);
> -	scsi_host_put(target->scsi_host);
> +	destruct_scsi_host_and_target(target, 0);

Is not disconnecting from the target here actually the right thing to
do? considering we're then destroying the target's queue pairs and
freeing it?

Cheers,
Muli



More information about the general mailing list