aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc/fc_lport.c
diff options
context:
space:
mode:
authorAbhijeet Joglekar <abjoglek@cisco.com>2009-04-21 19:26:58 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-04-27 11:18:51 -0400
commit76f6804e7e7bb836cbdf4a73fe6c5485e4cc04c2 (patch)
tree84a01586a05b430ca327709173a65e53b793ca88 /drivers/scsi/libfc/fc_lport.c
parent0d228c0f7f9e3ade147e57682915c55b92448230 (diff)
[SCSI] libfc: Do not retry if the new state is not the same as old state
For instance, if there is a Plogi pending (remote port is in Plogi state), and the state changes to say NONE (because the port is being logged off), then when the Plogi resp times out, do not start a retry. This patch partially reverts an earlier patch (libfc: check for err when recv and state is incorrect), by moving the state check back to before checking for error. However, if the state does not match, then there is an additional check to see if its an error ptr or a real frame before jumping to err or out respectively. Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libfc/fc_lport.c')
-rw-r--r--drivers/scsi/libfc/fc_lport.c60
1 files changed, 35 insertions, 25 deletions
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index b8178ef398d7..52c4f2dfcfd3 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1032,17 +1032,19 @@ static void fc_lport_rft_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1032 1032
1033 FC_DEBUG_LPORT("Received a RFT_ID response\n"); 1033 FC_DEBUG_LPORT("Received a RFT_ID response\n");
1034 1034
1035 if (IS_ERR(fp)) {
1036 fc_lport_error(lport, fp);
1037 goto err;
1038 }
1039
1040 if (lport->state != LPORT_ST_RFT_ID) { 1035 if (lport->state != LPORT_ST_RFT_ID) {
1041 FC_DBG("Received a RFT_ID response, but in state %s\n", 1036 FC_DBG("Received a RFT_ID response, but in state %s\n",
1042 fc_lport_state(lport)); 1037 fc_lport_state(lport));
1038 if (IS_ERR(fp))
1039 goto err;
1043 goto out; 1040 goto out;
1044 } 1041 }
1045 1042
1043 if (IS_ERR(fp)) {
1044 fc_lport_error(lport, fp);
1045 goto err;
1046 }
1047
1046 fh = fc_frame_header_get(fp); 1048 fh = fc_frame_header_get(fp);
1047 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1049 ct = fc_frame_payload_get(fp, sizeof(*ct));
1048 1050
@@ -1084,17 +1086,19 @@ static void fc_lport_rpn_id_resp(struct fc_seq *sp, struct fc_frame *fp,
1084 1086
1085 FC_DEBUG_LPORT("Received a RPN_ID response\n"); 1087 FC_DEBUG_LPORT("Received a RPN_ID response\n");
1086 1088
1087 if (IS_ERR(fp)) {
1088 fc_lport_error(lport, fp);
1089 goto err;
1090 }
1091
1092 if (lport->state != LPORT_ST_RPN_ID) { 1089 if (lport->state != LPORT_ST_RPN_ID) {
1093 FC_DBG("Received a RPN_ID response, but in state %s\n", 1090 FC_DBG("Received a RPN_ID response, but in state %s\n",
1094 fc_lport_state(lport)); 1091 fc_lport_state(lport));
1092 if (IS_ERR(fp))
1093 goto err;
1095 goto out; 1094 goto out;
1096 } 1095 }
1097 1096
1097 if (IS_ERR(fp)) {
1098 fc_lport_error(lport, fp);
1099 goto err;
1100 }
1101
1098 fh = fc_frame_header_get(fp); 1102 fh = fc_frame_header_get(fp);
1099 ct = fc_frame_payload_get(fp, sizeof(*ct)); 1103 ct = fc_frame_payload_get(fp, sizeof(*ct));
1100 if (fh && ct && fh->fh_type == FC_TYPE_CT && 1104 if (fh && ct && fh->fh_type == FC_TYPE_CT &&
@@ -1134,17 +1138,19 @@ static void fc_lport_scr_resp(struct fc_seq *sp, struct fc_frame *fp,
1134 1138
1135 FC_DEBUG_LPORT("Received a SCR response\n"); 1139 FC_DEBUG_LPORT("Received a SCR response\n");
1136 1140
1137 if (IS_ERR(fp)) {
1138 fc_lport_error(lport, fp);
1139 goto err;
1140 }
1141
1142 if (lport->state != LPORT_ST_SCR) { 1141 if (lport->state != LPORT_ST_SCR) {
1143 FC_DBG("Received a SCR response, but in state %s\n", 1142 FC_DBG("Received a SCR response, but in state %s\n",
1144 fc_lport_state(lport)); 1143 fc_lport_state(lport));
1144 if (IS_ERR(fp))
1145 goto err;
1145 goto out; 1146 goto out;
1146 } 1147 }
1147 1148
1149 if (IS_ERR(fp)) {
1150 fc_lport_error(lport, fp);
1151 goto err;
1152 }
1153
1148 op = fc_frame_payload_op(fp); 1154 op = fc_frame_payload_op(fp);
1149 if (op == ELS_LS_ACC) 1155 if (op == ELS_LS_ACC)
1150 fc_lport_enter_ready(lport); 1156 fc_lport_enter_ready(lport);
@@ -1360,17 +1366,19 @@ static void fc_lport_logo_resp(struct fc_seq *sp, struct fc_frame *fp,
1360 1366
1361 FC_DEBUG_LPORT("Received a LOGO response\n"); 1367 FC_DEBUG_LPORT("Received a LOGO response\n");
1362 1368
1363 if (IS_ERR(fp)) {
1364 fc_lport_error(lport, fp);
1365 goto err;
1366 }
1367
1368 if (lport->state != LPORT_ST_LOGO) { 1369 if (lport->state != LPORT_ST_LOGO) {
1369 FC_DBG("Received a LOGO response, but in state %s\n", 1370 FC_DBG("Received a LOGO response, but in state %s\n",
1370 fc_lport_state(lport)); 1371 fc_lport_state(lport));
1372 if (IS_ERR(fp))
1373 goto err;
1371 goto out; 1374 goto out;
1372 } 1375 }
1373 1376
1377 if (IS_ERR(fp)) {
1378 fc_lport_error(lport, fp);
1379 goto err;
1380 }
1381
1374 op = fc_frame_payload_op(fp); 1382 op = fc_frame_payload_op(fp);
1375 if (op == ELS_LS_ACC) 1383 if (op == ELS_LS_ACC)
1376 fc_lport_enter_reset(lport); 1384 fc_lport_enter_reset(lport);
@@ -1444,17 +1452,19 @@ static void fc_lport_flogi_resp(struct fc_seq *sp, struct fc_frame *fp,
1444 1452
1445 FC_DEBUG_LPORT("Received a FLOGI response\n"); 1453 FC_DEBUG_LPORT("Received a FLOGI response\n");
1446 1454
1447 if (IS_ERR(fp)) {
1448 fc_lport_error(lport, fp);
1449 goto err;
1450 }
1451
1452 if (lport->state != LPORT_ST_FLOGI) { 1455 if (lport->state != LPORT_ST_FLOGI) {
1453 FC_DBG("Received a FLOGI response, but in state %s\n", 1456 FC_DBG("Received a FLOGI response, but in state %s\n",
1454 fc_lport_state(lport)); 1457 fc_lport_state(lport));
1458 if (IS_ERR(fp))
1459 goto err;
1455 goto out; 1460 goto out;
1456 } 1461 }
1457 1462
1463 if (IS_ERR(fp)) {
1464 fc_lport_error(lport, fp);
1465 goto err;
1466 }
1467
1458 fh = fc_frame_header_get(fp); 1468 fh = fc_frame_header_get(fp);
1459 did = ntoh24(fh->fh_d_id); 1469 did = ntoh24(fh->fh_d_id);
1460 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) { 1470 if (fc_frame_payload_op(fp) == ELS_LS_ACC && did != 0) {