Skip to content

Commit 512857a

Browse files
steffen-maiermartinkpetersen
authored andcommitted
scsi: zfcp: fix misleading REC trigger trace where erp_action setup failed
If a SCSI device is deleted during scsi_eh host reset, we cannot get a reference to the SCSI device anymore since scsi_device_get returns !=0 by design. Assuming the recovery of adapter and port(s) was successful, zfcp_erp_strategy_followup_success() attempts to trigger a LUN reset for the half-gone SCSI device. Unfortunately, it causes the following confusing trace record which states that zfcp will do a LUN recovery as "ERP need" is ZFCP_ERP_ACTION_REOPEN_LUN == 1 and equals "ERP want". Old example trace record formatted with zfcpdbf from s390-tools: Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded LUN : 0x<FCP_LUN> WWPN : 0x<WWPN> D_ID : 0x<N_Port-ID> Adapter status : 0x5400050b Port status : 0x54000001 LUN status : 0x40000000 ZFCP_STATUS_COMMON_RUNNING but not ZFCP_STATUS_COMMON_UNBLOCKED as it was closed on close part of adapter reopen ERP want : 0x01 ERP need : 0x01 misleading However, zfcp_erp_setup_act() returns NULL as it cannot get the reference. Hence, zfcp_erp_action_enqueue() takes an early goto out and _NO_ recovery actually happens. We always do want the recovery trigger trace record even if no erp_action could be enqueued as in this case. For other cases where we did not enqueue an erp_action, 'need' has always been zero to indicate this. In order to indicate above goto out, introduce an eyecatcher "flag" to mark the "ERP need" as 'not needed' but still keep the information which erp_action type, that zfcp_erp_required_act() had decided upon, is needed. 0xc_ is chosen to be visibly different from 0x0_ in "ERP want". New example trace record formatted with zfcpdbf from s390-tools: Tag: : ersfs_3 ERP, trigger, unit reopen, port reopen succeeded LUN : 0x<FCP_LUN> WWPN : 0x<WWPN> D_ID : 0x<N_Port-ID> Adapter status : 0x5400050b Port status : 0x54000001 LUN status : 0x40000000 ERP want : 0x01 ERP need : 0xc1 would need LUN ERP, but no action set up ^ Before v2.6.38 commit ae0904f ("[SCSI] zfcp: Redesign of the debug tracing for recovery actions.") we could detect this case because the "erp_action" field in the trace was NULL. The rework removed erp_action as argument and field from the trace. This patch here is for tracing. A fix to allow LUN recovery in the case at hand is a topic for a separate patch. See also commit fdbd1c5 ("[SCSI] zfcp: Allow running unit/LUN shutdown without acquiring reference") for a similar case and background info. Signed-off-by: Steffen Maier <maier@linux.ibm.com> Fixes: ae0904f ("[SCSI] zfcp: Redesign of the debug tracing for recovery actions.") 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 81979ae commit 512857a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/s390/scsi/zfcp_erp.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,23 @@ enum zfcp_erp_steps {
3535
ZFCP_ERP_STEP_LUN_OPENING = 0x2000,
3636
};
3737

38+
/**
39+
* enum zfcp_erp_act_type - Type of ERP action object.
40+
* @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
41+
* @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
42+
* @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
43+
* @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
44+
* @ZFCP_ERP_ACTION_NONE: Eyecatcher pseudo flag to bitwise or-combine with
45+
* either of the other enum values.
46+
* Used to indicate that an ERP action could not be
47+
* set up despite a detected need for some recovery.
48+
*/
3849
enum zfcp_erp_act_type {
3950
ZFCP_ERP_ACTION_REOPEN_LUN = 1,
4051
ZFCP_ERP_ACTION_REOPEN_PORT = 2,
4152
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
4253
ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
54+
ZFCP_ERP_ACTION_NONE = 0xc0,
4355
};
4456

4557
enum zfcp_erp_act_state {
@@ -257,8 +269,10 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
257269
goto out;
258270

259271
act = zfcp_erp_setup_act(need, act_status, adapter, port, sdev);
260-
if (!act)
272+
if (!act) {
273+
need |= ZFCP_ERP_ACTION_NONE; /* marker for trace */
261274
goto out;
275+
}
262276
atomic_or(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
263277
++adapter->erp_total_count;
264278
list_add_tail(&act->list, &adapter->erp_ready_head);

0 commit comments

Comments
 (0)