Skip to content

Commit 30fa41f

Browse files
steffen-maierZhengShunQian
authored andcommitted
scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
commit 8c3d20a upstream. That other commit introduced an inconsistency because it would trace on ERP_FAILED for all callers of port forced reopen triggers (not just terminate_rport_io), but it would not trace on ERP_FAILED for all callers of other ERP triggers such as adapter, port regular, LUN. Therefore, generalize that other commit. zfcp_erp_action_enqueue() already had two early outs which re-used the one zfcp_dbf_rec_trig() call. All ERP trigger functions finally run through zfcp_erp_action_enqueue(). So move the special handling for ZFCP_STATUS_COMMON_ERP_FAILED into zfcp_erp_action_enqueue() and add another early out with new trace marker for pseudo ERP need in this case. This removes all early returns from all ERP trigger functions so we always end up at zfcp_dbf_rec_trig(). Example trace record formatted with zfcpdbf from s390-tools: Timestamp : ... Area : REC Subarea : 00 Level : 1 Exception : - CPU ID : .. Caller : 0x... Record ID : 1 ZFCP_DBF_REC_TRIG Tag : ....... LUN : 0x... WWPN : 0x... D_ID : 0x... Adapter status : 0x... Port status : 0x... LUN status : 0x... Ready count : 0x... Running count : 0x... ERP want : 0x0. ZFCP_ERP_ACTION_REOPEN_... ERP need : 0xe0 ZFCP_ERP_ACTION_FAILED Signed-off-by: Steffen Maier <maier@linux.ibm.com> Cc: <stable@vger.kernel.org> #2.6.38+ Reviewed-by: Benjamin Block <bblock@linux.ibm.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 43cdde0 commit 30fa41f

File tree

1 file changed

+51
-28
lines changed

1 file changed

+51
-28
lines changed

drivers/s390/scsi/zfcp_erp.c

+51-28
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,49 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
142142
}
143143
}
144144

145+
static int zfcp_erp_handle_failed(int want, struct zfcp_adapter *adapter,
146+
struct zfcp_port *port,
147+
struct scsi_device *sdev)
148+
{
149+
int need = want;
150+
struct zfcp_scsi_dev *zsdev;
151+
152+
switch (want) {
153+
case ZFCP_ERP_ACTION_REOPEN_LUN:
154+
zsdev = sdev_to_zfcp(sdev);
155+
if (atomic_read(&zsdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
156+
need = 0;
157+
break;
158+
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
159+
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
160+
need = 0;
161+
break;
162+
case ZFCP_ERP_ACTION_REOPEN_PORT:
163+
if (atomic_read(&port->status) &
164+
ZFCP_STATUS_COMMON_ERP_FAILED) {
165+
need = 0;
166+
/* ensure propagation of failed status to new devices */
167+
zfcp_erp_set_port_status(
168+
port, ZFCP_STATUS_COMMON_ERP_FAILED);
169+
}
170+
break;
171+
case ZFCP_ERP_ACTION_REOPEN_ADAPTER:
172+
if (atomic_read(&adapter->status) &
173+
ZFCP_STATUS_COMMON_ERP_FAILED) {
174+
need = 0;
175+
/* ensure propagation of failed status to new devices */
176+
zfcp_erp_set_adapter_status(
177+
adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
178+
}
179+
break;
180+
default:
181+
need = 0;
182+
break;
183+
}
184+
185+
return need;
186+
}
187+
145188
static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
146189
struct zfcp_port *port,
147190
struct scsi_device *sdev)
@@ -265,6 +308,12 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
265308
int retval = 1, need;
266309
struct zfcp_erp_action *act;
267310

311+
need = zfcp_erp_handle_failed(want, adapter, port, sdev);
312+
if (!need) {
313+
need = ZFCP_ERP_ACTION_FAILED; /* marker for trace */
314+
goto out;
315+
}
316+
268317
if (!adapter->erp_thread)
269318
return -EIO;
270319

@@ -313,12 +362,6 @@ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
313362
zfcp_erp_adapter_block(adapter, clear_mask);
314363
zfcp_scsi_schedule_rports_block(adapter);
315364

316-
/* ensure propagation of failed status to new devices */
317-
if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
318-
zfcp_erp_set_adapter_status(adapter,
319-
ZFCP_STATUS_COMMON_ERP_FAILED);
320-
return -EIO;
321-
}
322365
return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
323366
adapter, NULL, NULL, id, 0);
324367
}
@@ -337,12 +380,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear, char *id)
337380
zfcp_scsi_schedule_rports_block(adapter);
338381

339382
write_lock_irqsave(&adapter->erp_lock, flags);
340-
if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
341-
zfcp_erp_set_adapter_status(adapter,
342-
ZFCP_STATUS_COMMON_ERP_FAILED);
343-
else
344-
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
345-
NULL, NULL, id, 0);
383+
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
384+
NULL, NULL, id, 0);
346385
write_unlock_irqrestore(&adapter->erp_lock, flags);
347386
}
348387

@@ -383,13 +422,6 @@ static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear,
383422
zfcp_erp_port_block(port, clear);
384423
zfcp_scsi_schedule_rport_block(port);
385424

386-
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
387-
zfcp_dbf_rec_trig(id, port->adapter, port, NULL,
388-
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
389-
ZFCP_ERP_ACTION_FAILED);
390-
return;
391-
}
392-
393425
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT_FORCED,
394426
port->adapter, port, NULL, id, 0);
395427
}
@@ -415,12 +447,6 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id)
415447
zfcp_erp_port_block(port, clear);
416448
zfcp_scsi_schedule_rport_block(port);
417449

418-
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
419-
/* ensure propagation of failed status to new devices */
420-
zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
421-
return -EIO;
422-
}
423-
424450
return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_PORT,
425451
port->adapter, port, NULL, id, 0);
426452
}
@@ -460,9 +486,6 @@ static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
460486

461487
zfcp_erp_lun_block(sdev, clear);
462488

463-
if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
464-
return;
465-
466489
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_LUN, adapter,
467490
zfcp_sdev->port, sdev, id, act_status);
468491
}

0 commit comments

Comments
 (0)