This patch fixes a bug where devloss is not called on fc_host teardown. The issues is seen if the LLDD uses rport_rolechg to add target role to rport. When an rport is discovered the LLDD uses fc_rport_add to add the rport and then uses remote_port_rolechg to indicate that it is a target. If this rport goes away and the LLDD calls fc_report_port_delete. The transport calls devloss after the devloss timer fires and it sets the FC_RPORT_DEVLOSS_CALLBK_DONE flag. If the LLDD discovers this target again and uses remote_port_add to add it, but it was a target and there is no target role assigned yet then this function returns without clearing the FC_RPORT_DEVLOSS_CALLBACK_DONE flag. When the LLDD calls again to change the role to a target the report_port_rolechg routine neglects to clear the flag as well. Once in this state, if the LLDD tears down the fc_host then devloss will not be called for this target because the DEVLOSS_CALLBK_DONE flag is still set. This patch adds the FC_RPORT_DEVLOSS_CALLBK_DONE flag to the group of flags that it clears when flushing devloss timers. Signed-off-by: Alex Iannicelli <alex.iannicelli@xxxxxxxxxx> Signed-off-by: James Smart <james.smart@xxxxxxxxxx> --- diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 1b21491..f59d4a0 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -3048,7 +3048,8 @@ fc_remote_port_rolechg(struct fc_rport *rport, u32 roles) spin_lock_irqsave(shost->host_lock, flags); rport->flags &= ~(FC_RPORT_FAST_FAIL_TIMEDOUT | - FC_RPORT_DEVLOSS_PENDING); + FC_RPORT_DEVLOSS_PENDING | + FC_RPORT_DEVLOSS_CALLBK_DONE); spin_unlock_irqrestore(shost->host_lock, flags); /* ensure any stgt delete functions are done */ -- 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