1 From: Gerald Schaefer <geraldsc@de.ibm.com>
2 Subject: zfcp: Send ELS ADISC from workqueue
3 References: bnc#482818,LTC#51958
5 Symptom: Remote port status change not handled
6 with high I/O load on other ports.
7 Problem: The ELS ADISC command used for checking
8 the remote port status could not be sent
9 because of a full request queue.
10 Solution: Move issing the ELS ADISC request to
11 a workqueue that can wait for a slot
12 in the request queue to become free.
14 Acked-by: John Jolly <jjolly@suse.de>
16 drivers/s390/scsi/zfcp_aux.c | 1 +
17 drivers/s390/scsi/zfcp_def.h | 1 +
18 drivers/s390/scsi/zfcp_ext.h | 1 +
19 drivers/s390/scsi/zfcp_fc.c | 28 ++++++++++++++++++----------
20 drivers/s390/scsi/zfcp_fsf.c | 18 ++++++------------
21 5 files changed, 27 insertions(+), 22 deletions(-)
23 --- a/drivers/s390/scsi/zfcp_aux.c
24 +++ b/drivers/s390/scsi/zfcp_aux.c
25 @@ -611,6 +611,7 @@ struct zfcp_port *zfcp_port_enqueue(stru
26 init_waitqueue_head(&port->remove_wq);
27 INIT_LIST_HEAD(&port->unit_list_head);
28 INIT_WORK(&port->gid_pn_work, zfcp_erp_port_strategy_open_lookup);
29 + INIT_WORK(&port->test_link_work, zfcp_fc_link_test_work);
31 port->adapter = adapter;
33 --- a/drivers/s390/scsi/zfcp_def.h
34 +++ b/drivers/s390/scsi/zfcp_def.h
35 @@ -539,6 +539,7 @@ struct zfcp_port {
37 u32 supported_classes;
38 struct work_struct gid_pn_work;
39 + struct work_struct test_link_work;
43 --- a/drivers/s390/scsi/zfcp_ext.h
44 +++ b/drivers/s390/scsi/zfcp_ext.h
45 @@ -101,6 +101,7 @@ extern void zfcp_fc_incoming_els(struct
46 extern int zfcp_fc_ns_gid_pn(struct zfcp_erp_action *);
47 extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
48 extern void zfcp_test_link(struct zfcp_port *);
49 +extern void zfcp_fc_link_test_work(struct work_struct *);
50 extern void zfcp_fc_nameserver_init(struct zfcp_adapter *);
53 --- a/drivers/s390/scsi/zfcp_fc.c
54 +++ b/drivers/s390/scsi/zfcp_fc.c
55 @@ -415,19 +415,12 @@ static int zfcp_fc_adisc(struct zfcp_por
56 return zfcp_fsf_send_els(&adisc->els);
60 - * zfcp_test_link - lightweight link test procedure
61 - * @port: port to be tested
63 - * Test status of a link to a remote port using the ELS command ADISC.
64 - * If there is a problem with the remote port, error recovery steps
65 - * will be triggered.
67 -void zfcp_test_link(struct zfcp_port *port)
68 +void zfcp_fc_link_test_work(struct work_struct *work)
70 + struct zfcp_port *port =
71 + container_of(work, struct zfcp_port, test_link_work);
74 - zfcp_port_get(port);
75 retval = zfcp_fc_adisc(port);
78 @@ -438,6 +431,21 @@ void zfcp_test_link(struct zfcp_port *po
79 zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
83 + * zfcp_test_link - lightweight link test procedure
84 + * @port: port to be tested
86 + * Test status of a link to a remote port using the ELS command ADISC.
87 + * If there is a problem with the remote port, error recovery steps
88 + * will be triggered.
90 +void zfcp_test_link(struct zfcp_port *port)
92 + zfcp_port_get(port);
93 + if (!queue_work(zfcp_data.work_queue, &port->test_link_work))
94 + zfcp_port_put(port);
97 static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num)
99 struct scatterlist *sg = &gpn_ft->sg_req;
100 --- a/drivers/s390/scsi/zfcp_fsf.c
101 +++ b/drivers/s390/scsi/zfcp_fsf.c
102 @@ -654,14 +654,6 @@ static int zfcp_fsf_sbal_check(struct zf
106 -static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
108 - unsigned int count = atomic_read(&adapter->req_q.count);
110 - atomic_inc(&adapter->qdio_outb_full);
114 static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
117 @@ -1177,8 +1169,8 @@ int zfcp_fsf_send_els(struct zfcp_send_e
118 ZFCP_STATUS_COMMON_UNBLOCKED)))
121 - spin_lock(&adapter->req_q_lock);
122 - if (!zfcp_fsf_sbal_available(adapter))
123 + spin_lock_bh(&adapter->req_q_lock);
124 + if (zfcp_fsf_req_sbal_get(adapter))
126 req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
127 ZFCP_REQ_AUTO_CLEANUP, NULL);
128 @@ -1211,7 +1203,7 @@ int zfcp_fsf_send_els(struct zfcp_send_e
130 zfcp_fsf_req_free(req);
132 - spin_unlock(&adapter->req_q_lock);
133 + spin_unlock_bh(&adapter->req_q_lock);
137 @@ -2336,8 +2328,10 @@ int zfcp_fsf_send_fcp_command_task(struc
140 spin_lock(&adapter->req_q_lock);
141 - if (!zfcp_fsf_sbal_available(adapter))
142 + if (atomic_read(&adapter->req_q.count) <= 0) {
143 + atomic_inc(&adapter->qdio_outb_full);
146 req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
147 adapter->pool.fsf_req_scsi);