]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.5/zfcp-trace-on-request-for-open-and-close-of-wka-port.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / zfcp-trace-on-request-for-open-and-close-of-wka-port.patch
1 From d27a7cb91960cf1fdd11b10071e601828cbf4b1f Mon Sep 17 00:00:00 2001
2 From: Steffen Maier <maier@linux.vnet.ibm.com>
3 Date: Wed, 10 Aug 2016 18:30:49 +0200
4 Subject: zfcp: trace on request for open and close of WKA port
5
6 From: Steffen Maier <maier@linux.vnet.ibm.com>
7
8 commit d27a7cb91960cf1fdd11b10071e601828cbf4b1f upstream.
9
10 Since commit a54ca0f62f953898b05549391ac2a8a4dad6482b
11 ("[SCSI] zfcp: Redesign of the debug tracing for HBA records.")
12 HBA records no longer contain WWPN, D_ID, or LUN
13 to reduce duplicate information which is already in REC records.
14 In contrast to "regular" target ports, we don't use recovery to open
15 WKA ports such as directory/nameserver, so we don't get REC records.
16 Therefore, introduce pseudo REC running records without any
17 actual recovery action but including D_ID of WKA port on open/close.
18
19 Signed-off-by: Steffen Maier <maier@linux.vnet.ibm.com>
20 Fixes: a54ca0f62f95 ("[SCSI] zfcp: Redesign of the debug tracing for HBA records.")
21 Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
22 Reviewed-by: Hannes Reinecke <hare@suse.com>
23 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25
26 ---
27 drivers/s390/scsi/zfcp_dbf.c | 32 ++++++++++++++++++++++++++++++++
28 drivers/s390/scsi/zfcp_ext.h | 1 +
29 drivers/s390/scsi/zfcp_fsf.c | 8 ++++++--
30 3 files changed, 39 insertions(+), 2 deletions(-)
31
32 --- a/drivers/s390/scsi/zfcp_dbf.c
33 +++ b/drivers/s390/scsi/zfcp_dbf.c
34 @@ -321,6 +321,38 @@ void zfcp_dbf_rec_run(char *tag, struct
35 spin_unlock_irqrestore(&dbf->rec_lock, flags);
36 }
37
38 +/**
39 + * zfcp_dbf_rec_run_wka - trace wka port event with info like running recovery
40 + * @tag: identifier for event
41 + * @wka_port: well known address port
42 + * @req_id: request ID to correlate with potential HBA trace record
43 + */
44 +void zfcp_dbf_rec_run_wka(char *tag, struct zfcp_fc_wka_port *wka_port,
45 + u64 req_id)
46 +{
47 + struct zfcp_dbf *dbf = wka_port->adapter->dbf;
48 + struct zfcp_dbf_rec *rec = &dbf->rec_buf;
49 + unsigned long flags;
50 +
51 + spin_lock_irqsave(&dbf->rec_lock, flags);
52 + memset(rec, 0, sizeof(*rec));
53 +
54 + rec->id = ZFCP_DBF_REC_RUN;
55 + memcpy(rec->tag, tag, ZFCP_DBF_TAG_LEN);
56 + rec->port_status = wka_port->status;
57 + rec->d_id = wka_port->d_id;
58 + rec->lun = ZFCP_DBF_INVALID_LUN;
59 +
60 + rec->u.run.fsf_req_id = req_id;
61 + rec->u.run.rec_status = ~0;
62 + rec->u.run.rec_step = ~0;
63 + rec->u.run.rec_action = ~0;
64 + rec->u.run.rec_count = ~0;
65 +
66 + debug_event(dbf->rec, 1, rec, sizeof(*rec));
67 + spin_unlock_irqrestore(&dbf->rec_lock, flags);
68 +}
69 +
70 static inline
71 void zfcp_dbf_san(char *tag, struct zfcp_dbf *dbf, void *data, u8 id, u16 len,
72 u64 req_id, u32 d_id)
73 --- a/drivers/s390/scsi/zfcp_ext.h
74 +++ b/drivers/s390/scsi/zfcp_ext.h
75 @@ -35,6 +35,7 @@ extern void zfcp_dbf_adapter_unregister(
76 extern void zfcp_dbf_rec_trig(char *, struct zfcp_adapter *,
77 struct zfcp_port *, struct scsi_device *, u8, u8);
78 extern void zfcp_dbf_rec_run(char *, struct zfcp_erp_action *);
79 +extern void zfcp_dbf_rec_run_wka(char *, struct zfcp_fc_wka_port *, u64);
80 extern void zfcp_dbf_hba_fsf_uss(char *, struct zfcp_fsf_req *);
81 extern void zfcp_dbf_hba_fsf_res(char *, int, struct zfcp_fsf_req *);
82 extern void zfcp_dbf_hba_bit_err(char *, struct zfcp_fsf_req *);
83 --- a/drivers/s390/scsi/zfcp_fsf.c
84 +++ b/drivers/s390/scsi/zfcp_fsf.c
85 @@ -1581,7 +1581,7 @@ out:
86 int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
87 {
88 struct zfcp_qdio *qdio = wka_port->adapter->qdio;
89 - struct zfcp_fsf_req *req;
90 + struct zfcp_fsf_req *req = NULL;
91 int retval = -EIO;
92
93 spin_lock_irq(&qdio->req_q_lock);
94 @@ -1610,6 +1610,8 @@ int zfcp_fsf_open_wka_port(struct zfcp_f
95 zfcp_fsf_req_free(req);
96 out:
97 spin_unlock_irq(&qdio->req_q_lock);
98 + if (req && !IS_ERR(req))
99 + zfcp_dbf_rec_run_wka("fsowp_1", wka_port, req->req_id);
100 return retval;
101 }
102
103 @@ -1634,7 +1636,7 @@ static void zfcp_fsf_close_wka_port_hand
104 int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
105 {
106 struct zfcp_qdio *qdio = wka_port->adapter->qdio;
107 - struct zfcp_fsf_req *req;
108 + struct zfcp_fsf_req *req = NULL;
109 int retval = -EIO;
110
111 spin_lock_irq(&qdio->req_q_lock);
112 @@ -1663,6 +1665,8 @@ int zfcp_fsf_close_wka_port(struct zfcp_
113 zfcp_fsf_req_free(req);
114 out:
115 spin_unlock_irq(&qdio->req_q_lock);
116 + if (req && !IS_ERR(req))
117 + zfcp_dbf_rec_run_wka("fscwp_1", wka_port, req->req_id);
118 return retval;
119 }
120