On Sat, 2012-01-14 at 12:54 +0000, Bart Van Assche wrote:
> The sysfs attribute 'add_target' may be used to relogin to a
> target. An SRP target that receives a second login request from
> an initiator will disconnect the previous connection. So before
> trying to reconnect, check whether another connection to the
> same SRP target identifier already exists. If so, remove the
> target port. Add a target to the target list before connecting
> instead of after such that this algorithm has a chance to work.
I was OK before with preventing the addition of a duplicate connection,
but the initiator shouldn't be enforcing the removal of previous
connections -- that should happen via the target issuing a DREQ.
If you're going to disallow duplicate requests, then just disallow
adding the new one, don't tear down the old one -- let the admin
manually do that if desired.
> +/**
> + * srp_conn_unique() - Check whether the connection to a target is unique.
> + *
> + * Connections are compared by their SCSI target port identifier: identifier
> + * extension + IO controller GUID. See also paragraph B.5 in the SRP spec.
> + */
> +static bool srp_conn_unique(struct srp_host *host,
> + struct srp_target_port *target)
> +{
> + struct srp_target_port *t;
> + bool ret = true;
> +
> + spin_lock(&host->target_lock);
> + list_for_each_entry(t, &host->target_list, list) {
> + if (t != target &&
> + target->id_ext == t->id_ext &&
> + target->ioc_guid == t->ioc_guid) {
You also need to consider target->initiator_ext here -- that will change
the I_T nexus.
--
Dave Dillow
National Center for Computational Science
Oak Ridge National Laboratory
(865) 241-6602 office
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html