Skip to content

Commit 799b76d

Browse files
Christof SchmittJames Bottomley
authored andcommitted
[SCSI] zfcp: Decouple gid_pn requests from erp
Don't let the erp wait for gid_pn requests to complete. Instead, queue the gid_pn work, exit erp and let the finished gid_pn work trigger a new port reopen. Reviewed-by: Swen Schillig <[email protected]> Signed-off-by: Christof Schmitt <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent 564e1c8 commit 799b76d

File tree

6 files changed

+47
-56
lines changed

6 files changed

+47
-56
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter)
362362
if (!adapter->pool.erp_req)
363363
return -ENOMEM;
364364

365+
adapter->pool.gid_pn_req =
366+
mempool_create_kmalloc_pool(1, sizeof(struct zfcp_fsf_req));
367+
if (!adapter->pool.gid_pn_req)
368+
return -ENOMEM;
369+
365370
adapter->pool.scsi_req =
366371
mempool_create_kmalloc_pool(1, sizeof(struct zfcp_fsf_req));
367372
if (!adapter->pool.scsi_req)
@@ -379,7 +384,7 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter)
379384
return -ENOMEM;
380385

381386
adapter->pool.qtcb_pool =
382-
mempool_create_slab_pool(3, zfcp_data.qtcb_cache);
387+
mempool_create_slab_pool(4, zfcp_data.qtcb_cache);
383388
if (!adapter->pool.qtcb_pool)
384389
return -ENOMEM;
385390

@@ -652,7 +657,7 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn,
652657

653658
init_waitqueue_head(&port->remove_wq);
654659
INIT_LIST_HEAD(&port->unit_list_head);
655-
INIT_WORK(&port->gid_pn_work, zfcp_erp_port_strategy_open_lookup);
660+
INIT_WORK(&port->gid_pn_work, zfcp_fc_port_did_lookup);
656661
INIT_WORK(&port->test_link_work, zfcp_fc_link_test_work);
657662
INIT_WORK(&port->rport_work, zfcp_scsi_rport_work);
658663

drivers/s390/scsi/zfcp_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ struct zfcp_fsf_req;
265265
/* holds various memory pools of an adapter */
266266
struct zfcp_adapter_mempool {
267267
mempool_t *erp_req;
268+
mempool_t *gid_pn_req;
268269
mempool_t *scsi_req;
269270
mempool_t *scsi_abort;
270271
mempool_t *status_read_req;

drivers/s390/scsi/zfcp_erp.c

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ enum zfcp_erp_steps {
2626
ZFCP_ERP_STEP_FSF_XCONFIG = 0x0001,
2727
ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
2828
ZFCP_ERP_STEP_PORT_CLOSING = 0x0100,
29-
ZFCP_ERP_STEP_NAMESERVER_LOOKUP = 0x0400,
3029
ZFCP_ERP_STEP_PORT_OPENING = 0x0800,
3130
ZFCP_ERP_STEP_UNIT_CLOSING = 0x1000,
3231
ZFCP_ERP_STEP_UNIT_OPENING = 0x2000,
@@ -842,27 +841,6 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act)
842841
return zfcp_erp_port_strategy_open_port(act);
843842
}
844843

845-
void zfcp_erp_port_strategy_open_lookup(struct work_struct *work)
846-
{
847-
int retval;
848-
struct zfcp_port *port = container_of(work, struct zfcp_port,
849-
gid_pn_work);
850-
851-
retval = zfcp_fc_ns_gid_pn(&port->erp_action);
852-
if (!retval) {
853-
port->erp_action.step = ZFCP_ERP_STEP_NAMESERVER_LOOKUP;
854-
goto out;
855-
}
856-
if (retval == -ENOMEM) {
857-
zfcp_erp_notify(&port->erp_action, ZFCP_STATUS_ERP_LOWMEM);
858-
goto out;
859-
}
860-
/* all other error condtions */
861-
zfcp_erp_notify(&port->erp_action, 0);
862-
out:
863-
zfcp_port_put(port);
864-
}
865-
866844
static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
867845
{
868846
struct zfcp_adapter *adapter = act->adapter;
@@ -880,12 +858,8 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
880858
if (!queue_work(adapter->work_queue,
881859
&port->gid_pn_work))
882860
zfcp_port_put(port);
883-
return ZFCP_ERP_CONTINUES;
861+
return ZFCP_ERP_EXIT;
884862
}
885-
/* fall through */
886-
case ZFCP_ERP_STEP_NAMESERVER_LOOKUP:
887-
if (!port->d_id)
888-
return ZFCP_ERP_FAILED;
889863
return zfcp_erp_port_strategy_open_port(act);
890864

891865
case ZFCP_ERP_STEP_PORT_OPENING:

drivers/s390/scsi/zfcp_ext.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,12 @@ extern void zfcp_erp_unit_access_denied(struct zfcp_unit *, char *, void *);
9494
extern void zfcp_erp_adapter_access_changed(struct zfcp_adapter *, char *,
9595
void *);
9696
extern void zfcp_erp_timeout_handler(unsigned long);
97-
extern void zfcp_erp_port_strategy_open_lookup(struct work_struct *);
9897

9998
/* zfcp_fc.c */
10099
extern int zfcp_scan_ports(struct zfcp_adapter *);
101100
extern void _zfcp_scan_ports_later(struct work_struct *);
102101
extern void zfcp_fc_incoming_els(struct zfcp_fsf_req *);
103-
extern int zfcp_fc_ns_gid_pn(struct zfcp_erp_action *);
102+
extern void zfcp_fc_port_did_lookup(struct work_struct *);
104103
extern void zfcp_fc_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
105104
extern void zfcp_test_link(struct zfcp_port *);
106105
extern void zfcp_fc_link_test_work(struct work_struct *);
@@ -128,8 +127,7 @@ extern struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *,
128127
extern void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *);
129128
extern int zfcp_fsf_status_read(struct zfcp_qdio *);
130129
extern int zfcp_status_read_refill(struct zfcp_adapter *adapter);
131-
extern int zfcp_fsf_send_ct(struct zfcp_send_ct *, mempool_t *,
132-
struct zfcp_erp_action *);
130+
extern int zfcp_fsf_send_ct(struct zfcp_send_ct *, mempool_t *);
133131
extern int zfcp_fsf_send_els(struct zfcp_send_els *);
134132
extern int zfcp_fsf_send_fcp_command_task(struct zfcp_unit *,
135133
struct scsi_cmnd *);

drivers/s390/scsi/zfcp_fc.c

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ static void zfcp_fc_ns_gid_pn_eval(unsigned long data)
282282
port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK;
283283
}
284284

285-
int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action,
285+
static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port,
286286
struct zfcp_gid_pn_data *gid_pn)
287287
{
288-
struct zfcp_adapter *adapter = erp_action->adapter;
288+
struct zfcp_adapter *adapter = port->adapter;
289289
struct zfcp_fc_ns_handler_data compl_rec;
290290
int ret;
291291

292292
/* setup parameters for send generic command */
293-
gid_pn->port = erp_action->port;
293+
gid_pn->port = port;
294294
gid_pn->ct.wka_port = &adapter->gs->ds;
295295
gid_pn->ct.handler = zfcp_fc_ns_handler;
296296
gid_pn->ct.handler_data = (unsigned long) &compl_rec;
@@ -309,27 +309,27 @@ int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action,
309309
gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS;
310310
gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN;
311311
gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_SIZE_ONE_PAGE / 4;
312-
gid_pn->ct_iu_req.wwpn = erp_action->port->wwpn;
312+
gid_pn->ct_iu_req.wwpn = port->wwpn;
313313

314314
init_completion(&compl_rec.done);
315315
compl_rec.handler = zfcp_fc_ns_gid_pn_eval;
316316
compl_rec.handler_data = (unsigned long) gid_pn;
317-
ret = zfcp_fsf_send_ct(&gid_pn->ct, adapter->pool.erp_req, erp_action);
317+
ret = zfcp_fsf_send_ct(&gid_pn->ct, adapter->pool.gid_pn_req);
318318
if (!ret)
319319
wait_for_completion(&compl_rec.done);
320320
return ret;
321321
}
322322

323323
/**
324324
* zfcp_fc_ns_gid_pn_request - initiate GID_PN nameserver request
325-
* @erp_action: pointer to zfcp_erp_action where GID_PN request is needed
325+
* @port: port where GID_PN request is needed
326326
* return: -ENOMEM on error, 0 otherwise
327327
*/
328-
int zfcp_fc_ns_gid_pn(struct zfcp_erp_action *erp_action)
328+
static int zfcp_fc_ns_gid_pn(struct zfcp_port *port)
329329
{
330330
int ret;
331331
struct zfcp_gid_pn_data *gid_pn;
332-
struct zfcp_adapter *adapter = erp_action->adapter;
332+
struct zfcp_adapter *adapter = port->adapter;
333333

334334
gid_pn = mempool_alloc(adapter->pool.gid_pn_data, GFP_ATOMIC);
335335
if (!gid_pn)
@@ -341,14 +341,37 @@ int zfcp_fc_ns_gid_pn(struct zfcp_erp_action *erp_action)
341341
if (ret)
342342
goto out;
343343

344-
ret = zfcp_fc_ns_gid_pn_request(erp_action, gid_pn);
344+
ret = zfcp_fc_ns_gid_pn_request(port, gid_pn);
345345

346346
zfcp_wka_port_put(&adapter->gs->ds);
347347
out:
348348
mempool_free(gid_pn, adapter->pool.gid_pn_data);
349349
return ret;
350350
}
351351

352+
void zfcp_fc_port_did_lookup(struct work_struct *work)
353+
{
354+
int ret;
355+
struct zfcp_port *port = container_of(work, struct zfcp_port,
356+
gid_pn_work);
357+
358+
ret = zfcp_fc_ns_gid_pn(port);
359+
if (ret) {
360+
/* could not issue gid_pn for some reason */
361+
zfcp_erp_adapter_reopen(port->adapter, 0, "fcgpn_1", NULL);
362+
goto out;
363+
}
364+
365+
if (!port->d_id) {
366+
zfcp_erp_port_failed(port, "fcgpn_2", NULL);
367+
goto out;
368+
}
369+
370+
zfcp_erp_port_reopen(port, 0, "fcgpn_3", NULL);
371+
out:
372+
zfcp_port_put(port);
373+
}
374+
352375
/**
353376
* zfcp_fc_plogi_evaluate - evaluate PLOGI playload
354377
* @port: zfcp_port structure
@@ -551,7 +574,7 @@ static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft,
551574

552575
init_completion(&compl_rec.done);
553576
compl_rec.handler = NULL;
554-
ret = zfcp_fsf_send_ct(ct, NULL, NULL);
577+
ret = zfcp_fsf_send_ct(ct, NULL);
555578
if (!ret)
556579
wait_for_completion(&compl_rec.done);
557580
return ret;
@@ -840,7 +863,7 @@ int zfcp_fc_execute_ct_fc_job(struct fc_bsg_job *job)
840863
ct_fc_job->ct.completion = NULL;
841864
ct_fc_job->job = job;
842865

843-
ret = zfcp_fsf_send_ct(&ct_fc_job->ct, NULL, NULL);
866+
ret = zfcp_fsf_send_ct(&ct_fc_job->ct, NULL);
844867
if (ret) {
845868
kfree(ct_fc_job);
846869
zfcp_wka_port_put(ct_fc_job->ct.wka_port);

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,10 +1069,8 @@ static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
10691069
* zfcp_fsf_send_ct - initiate a Generic Service request (FC-GS)
10701070
* @ct: pointer to struct zfcp_send_ct with data for request
10711071
* @pool: if non-null this mempool is used to allocate struct zfcp_fsf_req
1072-
* @erp_action: if non-null the Generic Service request sent within ERP
10731072
*/
1074-
int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1075-
struct zfcp_erp_action *erp_action)
1073+
int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool)
10761074
{
10771075
struct zfcp_wka_port *wka_port = ct->wka_port;
10781076
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
@@ -1103,13 +1101,7 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
11031101
req->data = ct;
11041102

11051103
zfcp_san_dbf_event_ct_request(req);
1106-
1107-
if (erp_action) {
1108-
erp_action->fsf_req = req;
1109-
req->erp_action = erp_action;
1110-
zfcp_fsf_start_erp_timer(req);
1111-
} else
1112-
zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
1104+
zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);
11131105

11141106
ret = zfcp_fsf_req_send(req);
11151107
if (ret)
@@ -1119,8 +1111,6 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
11191111

11201112
failed_send:
11211113
zfcp_fsf_req_free(req);
1122-
if (erp_action)
1123-
erp_action->fsf_req = NULL;
11241114
out:
11251115
spin_unlock_bh(&qdio->req_q_lock);
11261116
return ret;

0 commit comments

Comments
 (0)