aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_lport.c
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2009-07-29 20:04:27 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:05 -0400
commit1190d925813aab80d17ff10f26c115f5846b3308 (patch)
treea4d2de20afee5d22a3391b1305408a199d485771 /drivers/scsi/libfc/fc_lport.c
parentb1d9fd5574763abe5c763e32e3547a4adee9bd88 (diff)
[SCSI] libfc: stop login after fabric logoff
When removing the fcoe module, several lports were being shut down through fc_lport_fabric_logoff(). Occasionally, one would enter reset state before fc_lport_destroy() was called, and since link_up was still true, it would log back in. If we just clear link_up earlier, then we wouldn't be accepting LOGO requests from other initiators while we are shutting down. Fix by changing the LOGO response handler to enter DISABLED instead of RESET. Add an fc_lport_enter_disabled() function which does what fc_lport_enter_reset() did, except it doesn't proceed to FLOGI state. Move the code that was common between fc_lport_enter_reset() and fc_lport_enter_disabled() into a new fc_lport_reset_locked() function. 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.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 3b28190ca2eb..7bb451ab0b87 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -930,19 +930,14 @@ int fc_lport_reset(struct fc_lport *lport)
930EXPORT_SYMBOL(fc_lport_reset); 930EXPORT_SYMBOL(fc_lport_reset);
931 931
932/** 932/**
933 * fc_rport_enter_reset() - Reset the local port 933 * fc_lport_reset_locked() - Reset the local port
934 * @lport: Fibre Channel local port to be reset 934 * @lport: Fibre Channel local port to be reset
935 * 935 *
936 * Locking Note: The lport lock is expected to be held before calling 936 * Locking Note: The lport lock is expected to be held before calling
937 * this routine. 937 * this routine.
938 */ 938 */
939static void fc_lport_enter_reset(struct fc_lport *lport) 939static void fc_lport_reset_locked(struct fc_lport *lport)
940{ 940{
941 FC_LPORT_DBG(lport, "Entered RESET state from %s state\n",
942 fc_lport_state(lport));
943
944 fc_lport_state_enter(lport, LPORT_ST_RESET);
945
946 if (lport->dns_rp) 941 if (lport->dns_rp)
947 lport->tt.rport_logoff(lport->dns_rp); 942 lport->tt.rport_logoff(lport->dns_rp);
948 943
@@ -956,12 +951,43 @@ static void fc_lport_enter_reset(struct fc_lport *lport)
956 lport->tt.exch_mgr_reset(lport, 0, 0); 951 lport->tt.exch_mgr_reset(lport, 0, 0);
957 fc_host_fabric_name(lport->host) = 0; 952 fc_host_fabric_name(lport->host) = 0;
958 fc_host_port_id(lport->host) = 0; 953 fc_host_port_id(lport->host) = 0;
954}
955
956/**
957 * fc_lport_enter_reset() - Reset the local port
958 * @lport: Fibre Channel local port to be reset
959 *
960 * Locking Note: The lport lock is expected to be held before calling
961 * this routine.
962 */
963static void fc_lport_enter_reset(struct fc_lport *lport)
964{
965 FC_LPORT_DBG(lport, "Entered RESET state from %s state\n",
966 fc_lport_state(lport));
959 967
968 fc_lport_state_enter(lport, LPORT_ST_RESET);
969 fc_lport_reset_locked(lport);
960 if (lport->link_up) 970 if (lport->link_up)
961 fc_lport_enter_flogi(lport); 971 fc_lport_enter_flogi(lport);
962} 972}
963 973
964/** 974/**
975 * fc_lport_enter_disabled() - disable the local port
976 * @lport: Fibre Channel local port to be reset
977 *
978 * Locking Note: The lport lock is expected to be held before calling
979 * this routine.
980 */
981static void fc_lport_enter_disabled(struct fc_lport *lport)
982{
983 FC_LPORT_DBG(lport, "Entered disabled state from %s state\n",
984 fc_lport_state(lport));
985
986 fc_lport_state_enter(lport, LPORT_ST_DISABLED);
987 fc_lport_reset_locked(lport);
988}
989
990/**
965 * fc_lport_error() - Handler for any errors 991 * fc_lport_error() - Handler for any errors
966 * @lport: The fc_lport object 992 * @lport: The fc_lport object
967 * @fp: The frame pointer 993 * @fp: The frame pointer
@@ -1382,7 +1408,7 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1382 1408
1383 op = fc_frame_payload_op(fp); 1409 op = fc_frame_payload_op(fp);
1384 if (op == ELS_LS_ACC) 1410 if (op == ELS_LS_ACC)
1385 fc_lport_enter_reset(lport); 1411 fc_lport_enter_disabled(lport);
1386 else 1412 else
1387 fc_lport_error(lport, fp); 1413 fc_lport_error(lport, fp);
1388 1414