Skip to content

Commit f034260

Browse files
Joe EykholtJames Bottomley
authored andcommitted
[SCSI] libfc: fix indefinite rport restart
Remote ports were restarting indefinitely after getting rejects in PRLI. Fix by adding a counter of restarts and limiting that with the port login retry limit as well. 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@suse.de>
1 parent 4b2164d commit f034260

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

‎drivers/scsi/libfc/fc_rport.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ static void fc_rport_work(struct work_struct *work)
257257
case RPORT_EV_READY:
258258
ids = rdata->ids;
259259
rdata->event = RPORT_EV_NONE;
260+
rdata->major_retries = 0;
260261
kref_get(&rdata->kref);
261262
mutex_unlock(&rdata->rp_mutex);
262263

@@ -323,7 +324,10 @@ static void fc_rport_work(struct work_struct *work)
323324
if (port_id == FC_FID_DIR_SERV) {
324325
rdata->event = RPORT_EV_NONE;
325326
mutex_unlock(&rdata->rp_mutex);
326-
} else if (rdata->flags & FC_RP_STARTED) {
327+
} else if ((rdata->flags & FC_RP_STARTED) &&
328+
rdata->major_retries <
329+
lport->max_rport_retry_count) {
330+
rdata->major_retries++;
327331
rdata->event = RPORT_EV_NONE;
328332
FC_RPORT_DBG(rdata, "work restart\n");
329333
fc_rport_enter_plogi(rdata);

‎include/scsi/libfc.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct fc_rport_libfc_priv {
189189
* @disc_id: The discovery identifier
190190
* @maxframe_size: The maximum frame size
191191
* @retries: The retry count for the current state
192+
* @major_retries: The retry count for the entire PLOGI/PRLI state machine
192193
* @e_d_tov: Error detect timeout value (in msec)
193194
* @r_a_tov: Resource allocation timeout value (in msec)
194195
* @rp_mutex: The mutex that protects the remote port
@@ -206,6 +207,7 @@ struct fc_rport_priv {
206207
u16 disc_id;
207208
u16 maxframe_size;
208209
unsigned int retries;
210+
unsigned int major_retries;
209211
unsigned int e_d_tov;
210212
unsigned int r_a_tov;
211213
struct mutex rp_mutex;

0 commit comments

Comments
 (0)