Skip to content

Commit 8c3d20a

Browse files
steffen-maiermartinkpetersen
authored andcommitted
scsi: zfcp: fix missing REC trigger trace for all objects in ERP_FAILED
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>
1 parent d70aab5 commit 8c3d20a

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
@@ -143,6 +143,49 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
143143
}
144144
}
145145

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

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

@@ -314,12 +363,6 @@ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
314363
zfcp_erp_adapter_block(adapter, clear_mask);
315364
zfcp_scsi_schedule_rports_block(adapter);
316365

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

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

@@ -384,13 +423,6 @@ static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, int clear,
384423
zfcp_erp_port_block(port, clear);
385424
zfcp_scsi_schedule_rport_block(port);
386425

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

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

462488
zfcp_erp_lun_block(sdev, clear);
463489

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

0 commit comments

Comments
 (0)