]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.14.53/scsi-zfcp-fix-missing-scsi-trace-for-result-of-eh_host_reset_handler.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.14.53 / scsi-zfcp-fix-missing-scsi-trace-for-result-of-eh_host_reset_handler.patch
1 From df30781699f53e4fd4c494c6f7dd16e3d5c21d30 Mon Sep 17 00:00:00 2001
2 From: Steffen Maier <maier@linux.ibm.com>
3 Date: Thu, 17 May 2018 19:14:43 +0200
4 Subject: scsi: zfcp: fix missing SCSI trace for result of eh_host_reset_handler
5
6 From: Steffen Maier <maier@linux.ibm.com>
7
8 commit df30781699f53e4fd4c494c6f7dd16e3d5c21d30 upstream.
9
10 For problem determination we need to see whether and why we were successful
11 or not. This allows deduction of scsi_eh escalation.
12
13 Example trace record formatted with zfcpdbf from s390-tools:
14
15 Timestamp : ...
16 Area : SCSI
17 Subarea : 00
18 Level : 1
19 Exception : -
20 CPU ID : ..
21 Caller : 0x...
22 Record ID : 1
23 Tag : schrh_r SCSI host reset handler result
24 Request ID : 0x0000000000000000 none (invalid)
25 SCSI ID : 0xffffffff none (invalid)
26 SCSI LUN : 0xffffffff none (invalid)
27 SCSI LUN high : 0xffffffff none (invalid)
28 SCSI result : 0x00002002 field re-used for midlayer value: SUCCESS
29 or in other cases: 0x2009 == FAST_IO_FAIL
30 SCSI retries : 0xff none (invalid)
31 SCSI allowed : 0xff none (invalid)
32 SCSI scribble : 0xffffffffffffffff none (invalid)
33 SCSI opcode : ffffffff ffffffff ffffffff ffffffff none (invalid)
34 FCP rsp inf cod: 0xff none (invalid)
35 FCP rsp IU : 00000000 00000000 00000000 00000000 none (invalid)
36 00000000 00000000
37
38 v2.6.35 commit a1dbfddd02d2 ("[SCSI] zfcp: Pass return code from
39 fc_block_scsi_eh to scsi eh") introduced the first return with something
40 other than the previously hardcoded single SUCCESS return path.
41
42 Signed-off-by: Steffen Maier <maier@linux.ibm.com>
43 Fixes: a1dbfddd02d2 ("[SCSI] zfcp: Pass return code from fc_block_scsi_eh to scsi eh")
44 Cc: <stable@vger.kernel.org> #2.6.38+
45 Reviewed-by: Jens Remus <jremus@linux.ibm.com>
46 Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
47 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
48 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
49
50 ---
51 drivers/s390/scsi/zfcp_dbf.c | 40 ++++++++++++++++++++++++++++++++++++++++
52 drivers/s390/scsi/zfcp_ext.h | 2 ++
53 drivers/s390/scsi/zfcp_scsi.c | 11 ++++++-----
54 3 files changed, 48 insertions(+), 5 deletions(-)
55
56 --- a/drivers/s390/scsi/zfcp_dbf.c
57 +++ b/drivers/s390/scsi/zfcp_dbf.c
58 @@ -664,6 +664,46 @@ void zfcp_dbf_scsi(char *tag, int level,
59 spin_unlock_irqrestore(&dbf->scsi_lock, flags);
60 }
61
62 +/**
63 + * zfcp_dbf_scsi_eh() - Trace event for special cases of scsi_eh callbacks.
64 + * @tag: Identifier for event.
65 + * @adapter: Pointer to zfcp adapter as context for this event.
66 + * @scsi_id: SCSI ID/target to indicate scope of task management function (TMF).
67 + * @ret: Return value of calling function.
68 + *
69 + * This SCSI trace variant does not depend on any of:
70 + * scsi_cmnd, zfcp_fsf_req, scsi_device.
71 + */
72 +void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
73 + unsigned int scsi_id, int ret)
74 +{
75 + struct zfcp_dbf *dbf = adapter->dbf;
76 + struct zfcp_dbf_scsi *rec = &dbf->scsi_buf;
77 + unsigned long flags;
78 + static int const level = 1;
79 +
80 + if (unlikely(!debug_level_enabled(adapter->dbf->scsi, level)))
81 + return;
82 +
83 + spin_lock_irqsave(&dbf->scsi_lock, flags);
84 + memset(rec, 0, sizeof(*rec));
85 +
86 + memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
87 + rec->id = ZFCP_DBF_SCSI_CMND;
88 + rec->scsi_result = ret; /* re-use field, int is 4 bytes and fits */
89 + rec->scsi_retries = ~0;
90 + rec->scsi_allowed = ~0;
91 + rec->fcp_rsp_info = ~0;
92 + rec->scsi_id = scsi_id;
93 + rec->scsi_lun = (u32)ZFCP_DBF_INVALID_LUN;
94 + rec->scsi_lun_64_hi = (u32)(ZFCP_DBF_INVALID_LUN >> 32);
95 + rec->host_scribble = ~0;
96 + memset(rec->scsi_opcode, 0xff, ZFCP_DBF_SCSI_OPCODE);
97 +
98 + debug_event(dbf->scsi, level, rec, sizeof(*rec));
99 + spin_unlock_irqrestore(&dbf->scsi_lock, flags);
100 +}
101 +
102 static debug_info_t *zfcp_dbf_reg(const char *name, int size, int rec_size)
103 {
104 struct debug_info *d;
105 --- a/drivers/s390/scsi/zfcp_ext.h
106 +++ b/drivers/s390/scsi/zfcp_ext.h
107 @@ -52,6 +52,8 @@ extern void zfcp_dbf_san_res(char *, str
108 extern void zfcp_dbf_san_in_els(char *, struct zfcp_fsf_req *);
109 extern void zfcp_dbf_scsi(char *, int, struct scsi_cmnd *,
110 struct zfcp_fsf_req *);
111 +extern void zfcp_dbf_scsi_eh(char *tag, struct zfcp_adapter *adapter,
112 + unsigned int scsi_id, int ret);
113
114 /* zfcp_erp.c */
115 extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
116 --- a/drivers/s390/scsi/zfcp_scsi.c
117 +++ b/drivers/s390/scsi/zfcp_scsi.c
118 @@ -323,15 +323,16 @@ static int zfcp_scsi_eh_host_reset_handl
119 {
120 struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(scpnt->device);
121 struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
122 - int ret;
123 + int ret = SUCCESS, fc_ret;
124
125 zfcp_erp_adapter_reopen(adapter, 0, "schrh_1");
126 zfcp_erp_wait(adapter);
127 - ret = fc_block_scsi_eh(scpnt);
128 - if (ret)
129 - return ret;
130 + fc_ret = fc_block_scsi_eh(scpnt);
131 + if (fc_ret)
132 + ret = fc_ret;
133
134 - return SUCCESS;
135 + zfcp_dbf_scsi_eh("schrh_r", adapter, ~0, ret);
136 + return ret;
137 }
138
139 struct scsi_transport_template *zfcp_scsi_transport_template;