After its state is changed from FC_PORTSTATE_BLOCKED to FC_PORTSTATE_ONLINE, operations on rport that was scsi target_id but is not shown by new role seem racing with the operations in the dev_loss_work of rport. And new rport should be created for the sake of adding rport. Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx> --- --- o/linux-2.6.36-rc4/drivers/scsi/scsi_transport_fc.c 2010-09-13 07:07:38.000000000 +0800 +++ m/linux-2.6.36-rc4/drivers/scsi/scsi_transport_fc.c 2010-09-25 22:25:12.000000000 +0800 @@ -2672,7 +2672,17 @@ fc_remote_port_add(struct Scsi_Host *sho } if (match) { - + if (rport->scsi_target_id != -1 && + !(ids->roles & FC_PORT_ROLE_FCP_TARGET)) { + /* + * rport will be torn down by timer, + * and we have to create it. + */ + spin_unlock_irqrestore( + shost->host_lock, flags); + return fc_rport_create(shost, + channel, ids); + } memcpy(&rport->node_name, &ids->node_name, sizeof(rport->node_name)); memcpy(&rport->port_name, &ids->port_name, @@ -2781,6 +2791,11 @@ fc_remote_port_add(struct Scsi_Host *sho } if (match) { + if (!(ids->roles & FC_PORT_ROLE_FCP_TARGET)) { + spin_unlock_irqrestore(shost->host_lock, + flags); + return fc_rport_create(shost, channel, ids); + } memcpy(&rport->node_name, &ids->node_name, sizeof(rport->node_name)); memcpy(&rport->port_name, &ids->port_name, -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html