On 10/22/20 7:34 AM, Muneendra wrote: > @@ -2071,6 +2074,7 @@ fc_eh_timed_out(struct scsi_cmnd *scmd) > { > struct fc_rport *rport = starget_to_rport(scsi_target(scmd->device)); > > + fc_rport_chkmarginal_set_noretries(rport, scmd); > if (rport->port_state == FC_PORTSTATE_BLOCKED) > return BLK_EH_RESET_TIMER; If we are in port state marginal above, then we will try to abort the cmd, but if while doing the abort we call fc_remote_port_delete and fc_remote_port_add then the port state will be online when the EH callouts complete. In this case, the port state is online in the end, but we would fail the command like it was in marginal. > > @@ -2095,7 +2099,8 @@ fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, u64 lun) > if (rport->scsi_target_id == -1) > continue; > > - if (rport->port_state != FC_PORTSTATE_ONLINE) > + if ((rport->port_state != FC_PORTSTATE_ONLINE) && > + (rport->port_state != FC_PORTSTATE_MARGINAL)) > continue; > > if ((channel == rport->channel) && > @@ -2958,7 +2963,8 @@ fc_remote_port_delete(struct fc_rport *rport) > > spin_lock_irqsave(shost->host_lock, flags); > > - if (rport->port_state != FC_PORTSTATE_ONLINE) { > + if ((rport->port_state != FC_PORTSTATE_ONLINE) && > + (rport->port_state != FC_PORTSTATE_MARGINAL)) { > spin_unlock_irqrestore(shost->host_lock, flags); > return; It looks like if fc_remote_port_delete is called, then we will allow that function to set the port_state to blocked. If the problem is resolved then fc_remote_port_add will set the state to online. So it would look like the port state is now ok in the kernel, but would userspace still have it in the marginal port group? Did you want this behavior or did you want it to stay in marginal until your daemon marks it as online?