diff options
author | Joe Eykholt <jeykholt@cisco.com> | 2009-07-29 20:04:33 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-08-22 18:52:05 -0400 |
commit | e9ba8b427852937caee6ca39bb6f9a893bb32ae1 (patch) | |
tree | de3db30488262ae451b61322d9166db99872b198 /drivers/scsi/libfc/fc_lport.c | |
parent | 1190d925813aab80d17ff10f26c115f5846b3308 (diff) |
[SCSI] libfc: in fc_lport_destroy, flush rports after turning off link
During an fcoe module unload, we saw a problem where fc_rport_work()
finds the lport has been freed. The rdata points to an area
containing 0x6b6b6b6b... the pool poison value from kmem_free().
In fcoe_if_destroy() we call fc_fabric_logoff() then fc_lport_destroy().
fc_fabric_logoff() flushes the remote port work, but we're still receiving
requests, and an RSCN or PLOGI arrives which creates more rports.
Note that although the LLD also checks link_up, it doesn't do it
under the lport mutex, so it can deliver frames to
fc_lport_recv_req() even after link_up is cleared.
So, re-check link_up there.
We need to flush the rports by calling disc_stop_final()
after we clear link_up.
Signed-off-by: Joe Eykholt <jeykholt@cisco.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/libfc/fc_lport.c')
-rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c index 7bb451ab0b87..a430335ebf59 100644 --- a/drivers/scsi/libfc/fc_lport.c +++ b/drivers/scsi/libfc/fc_lport.c | |||
@@ -643,6 +643,7 @@ int fc_lport_destroy(struct fc_lport *lport) | |||
643 | mutex_unlock(&lport->lp_mutex); | 643 | mutex_unlock(&lport->lp_mutex); |
644 | 644 | ||
645 | lport->tt.fcp_abort_io(lport); | 645 | lport->tt.fcp_abort_io(lport); |
646 | lport->tt.disc_stop_final(lport); | ||
646 | lport->tt.exch_mgr_reset(lport, 0, 0); | 647 | lport->tt.exch_mgr_reset(lport, 0, 0); |
647 | return 0; | 648 | return 0; |
648 | } | 649 | } |
@@ -844,7 +845,10 @@ static void fc_lport_recv_req(struct fc_lport *lport, struct fc_seq *sp, | |||
844 | * RSCN here. These don't require a session. | 845 | * RSCN here. These don't require a session. |
845 | * Even if we had a session, it might not be ready. | 846 | * Even if we had a session, it might not be ready. |
846 | */ | 847 | */ |
847 | if (fh->fh_type == FC_TYPE_ELS && fh->fh_r_ctl == FC_RCTL_ELS_REQ) { | 848 | if (!lport->link_up) |
849 | fc_frame_free(fp); | ||
850 | else if (fh->fh_type == FC_TYPE_ELS && | ||
851 | fh->fh_r_ctl == FC_RCTL_ELS_REQ) { | ||
848 | /* | 852 | /* |
849 | * Check opcode. | 853 | * Check opcode. |
850 | */ | 854 | */ |