aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c89
1 files changed, 72 insertions, 17 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index c1f2d4b14c2b..aef66bc2b6ca 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -179,7 +179,7 @@ static void zfcp_close_fsf(struct zfcp_adapter *adapter)
179static void zfcp_fsf_request_timeout_handler(unsigned long data) 179static void zfcp_fsf_request_timeout_handler(unsigned long data)
180{ 180{
181 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; 181 struct zfcp_adapter *adapter = (struct zfcp_adapter *) data;
182 zfcp_erp_adapter_reopen(adapter, 0); 182 zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
183} 183}
184 184
185void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout) 185void zfcp_fsf_start_timer(struct zfcp_fsf_req *fsf_req, unsigned long timeout)
@@ -342,9 +342,9 @@ zfcp_erp_adisc(struct zfcp_port *port)
342 adisc->wwpn = fc_host_port_name(adapter->scsi_host); 342 adisc->wwpn = fc_host_port_name(adapter->scsi_host);
343 adisc->wwnn = fc_host_node_name(adapter->scsi_host); 343 adisc->wwnn = fc_host_node_name(adapter->scsi_host);
344 adisc->nport_id = fc_host_port_id(adapter->scsi_host); 344 adisc->nport_id = fc_host_port_id(adapter->scsi_host);
345 ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x " 345 ZFCP_LOG_INFO("ADISC request from s_id 0x%06x to d_id 0x%06x "
346 "(wwpn=0x%016Lx, wwnn=0x%016Lx, " 346 "(wwpn=0x%016Lx, wwnn=0x%016Lx, "
347 "hard_nport_id=0x%08x, nport_id=0x%08x)\n", 347 "hard_nport_id=0x%06x, nport_id=0x%06x)\n",
348 adisc->nport_id, send_els->d_id, (wwn_t) adisc->wwpn, 348 adisc->nport_id, send_els->d_id, (wwn_t) adisc->wwpn,
349 (wwn_t) adisc->wwnn, adisc->hard_nport_id, 349 (wwn_t) adisc->wwnn, adisc->hard_nport_id,
350 adisc->nport_id); 350 adisc->nport_id);
@@ -352,7 +352,7 @@ zfcp_erp_adisc(struct zfcp_port *port)
352 retval = zfcp_fsf_send_els(send_els); 352 retval = zfcp_fsf_send_els(send_els);
353 if (retval != 0) { 353 if (retval != 0) {
354 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port " 354 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port "
355 "0x%08x on adapter %s\n", send_els->d_id, 355 "0x%06x on adapter %s\n", send_els->d_id,
356 zfcp_get_busid_by_adapter(adapter)); 356 zfcp_get_busid_by_adapter(adapter));
357 goto freemem; 357 goto freemem;
358 } 358 }
@@ -398,7 +398,7 @@ zfcp_erp_adisc_handler(unsigned long data)
398 if (send_els->status != 0) { 398 if (send_els->status != 0) {
399 ZFCP_LOG_NORMAL("ELS request rejected/timed out, " 399 ZFCP_LOG_NORMAL("ELS request rejected/timed out, "
400 "force physical port reopen " 400 "force physical port reopen "
401 "(adapter %s, port d_id=0x%08x)\n", 401 "(adapter %s, port d_id=0x%06x)\n",
402 zfcp_get_busid_by_adapter(adapter), d_id); 402 zfcp_get_busid_by_adapter(adapter), d_id);
403 debug_text_event(adapter->erp_dbf, 3, "forcreop"); 403 debug_text_event(adapter->erp_dbf, 3, "forcreop");
404 if (zfcp_erp_port_forced_reopen(port, 0)) 404 if (zfcp_erp_port_forced_reopen(port, 0))
@@ -411,9 +411,9 @@ zfcp_erp_adisc_handler(unsigned long data)
411 411
412 adisc = zfcp_sg_to_address(send_els->resp); 412 adisc = zfcp_sg_to_address(send_els->resp);
413 413
414 ZFCP_LOG_INFO("ADISC response from d_id 0x%08x to s_id " 414 ZFCP_LOG_INFO("ADISC response from d_id 0x%06x to s_id "
415 "0x%08x (wwpn=0x%016Lx, wwnn=0x%016Lx, " 415 "0x%06x (wwpn=0x%016Lx, wwnn=0x%016Lx, "
416 "hard_nport_id=0x%08x, nport_id=0x%08x)\n", 416 "hard_nport_id=0x%06x, nport_id=0x%06x)\n",
417 d_id, fc_host_port_id(adapter->scsi_host), 417 d_id, fc_host_port_id(adapter->scsi_host),
418 (wwn_t) adisc->wwpn, (wwn_t) adisc->wwnn, 418 (wwn_t) adisc->wwpn, (wwn_t) adisc->wwnn,
419 adisc->hard_nport_id, adisc->nport_id); 419 adisc->hard_nport_id, adisc->nport_id);
@@ -847,8 +847,7 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
847 if (erp_action->fsf_req) { 847 if (erp_action->fsf_req) {
848 /* take lock to ensure that request is not deleted meanwhile */ 848 /* take lock to ensure that request is not deleted meanwhile */
849 spin_lock(&adapter->req_list_lock); 849 spin_lock(&adapter->req_list_lock);
850 if (zfcp_reqlist_ismember(adapter, 850 if (zfcp_reqlist_find(adapter, erp_action->fsf_req->req_id)) {
851 erp_action->fsf_req->req_id)) {
852 /* fsf_req still exists */ 851 /* fsf_req still exists */
853 debug_text_event(adapter->erp_dbf, 3, "a_ca_req"); 852 debug_text_event(adapter->erp_dbf, 3, "a_ca_req");
854 debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req, 853 debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req,
@@ -1377,7 +1376,7 @@ zfcp_erp_port_failed(struct zfcp_port *port)
1377 1376
1378 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 1377 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
1379 ZFCP_LOG_NORMAL("port erp failed (adapter %s, " 1378 ZFCP_LOG_NORMAL("port erp failed (adapter %s, "
1380 "port d_id=0x%08x)\n", 1379 "port d_id=0x%06x)\n",
1381 zfcp_get_busid_by_port(port), port->d_id); 1380 zfcp_get_busid_by_port(port), port->d_id);
1382 else 1381 else
1383 ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", 1382 ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n",
@@ -1591,6 +1590,62 @@ zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result)
1591 return result; 1590 return result;
1592} 1591}
1593 1592
1593struct zfcp_erp_add_work {
1594 struct zfcp_unit *unit;
1595 struct work_struct work;
1596};
1597
1598/**
1599 * zfcp_erp_scsi_scan
1600 * @data: pointer to a struct zfcp_erp_add_work
1601 *
1602 * Registers a logical unit with the SCSI stack.
1603 */
1604static void zfcp_erp_scsi_scan(struct work_struct *work)
1605{
1606 struct zfcp_erp_add_work *p =
1607 container_of(work, struct zfcp_erp_add_work, work);
1608 struct zfcp_unit *unit = p->unit;
1609 struct fc_rport *rport = unit->port->rport;
1610 scsi_scan_target(&rport->dev, 0, rport->scsi_target_id,
1611 unit->scsi_lun, 0);
1612 atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
1613 wake_up(&unit->scsi_scan_wq);
1614 zfcp_unit_put(unit);
1615 kfree(p);
1616}
1617
1618/**
1619 * zfcp_erp_schedule_work
1620 * @unit: pointer to unit which should be registered with SCSI stack
1621 *
1622 * Schedules work which registers a unit with the SCSI stack
1623 */
1624static void
1625zfcp_erp_schedule_work(struct zfcp_unit *unit)
1626{
1627 struct zfcp_erp_add_work *p;
1628
1629 p = kmalloc(sizeof(*p), GFP_KERNEL);
1630 if (!p) {
1631 ZFCP_LOG_NORMAL("error: Out of resources. Could not register "
1632 "the FCP-LUN 0x%Lx connected to "
1633 "the port with WWPN 0x%Lx connected to "
1634 "the adapter %s with the SCSI stack.\n",
1635 unit->fcp_lun,
1636 unit->port->wwpn,
1637 zfcp_get_busid_by_unit(unit));
1638 return;
1639 }
1640
1641 zfcp_unit_get(unit);
1642 memset(p, 0, sizeof(*p));
1643 atomic_set_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
1644 INIT_WORK(&p->work, zfcp_erp_scsi_scan);
1645 p->unit = unit;
1646 schedule_work(&p->work);
1647}
1648
1594/* 1649/*
1595 * function: 1650 * function:
1596 * 1651 *
@@ -2401,7 +2456,7 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2401 retval = ZFCP_ERP_FAILED; 2456 retval = ZFCP_ERP_FAILED;
2402 } 2457 }
2403 } else { 2458 } else {
2404 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%08x -> " 2459 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> "
2405 "trying open\n", port->wwpn, port->d_id); 2460 "trying open\n", port->wwpn, port->d_id);
2406 retval = zfcp_erp_port_strategy_open_port(erp_action); 2461 retval = zfcp_erp_port_strategy_open_port(erp_action);
2407 } 2462 }
@@ -2441,7 +2496,7 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action)
2441 case ZFCP_ERP_STEP_UNINITIALIZED: 2496 case ZFCP_ERP_STEP_UNINITIALIZED:
2442 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 2497 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
2443 case ZFCP_ERP_STEP_PORT_CLOSING: 2498 case ZFCP_ERP_STEP_PORT_CLOSING:
2444 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%08x -> trying open\n", 2499 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> trying open\n",
2445 port->wwpn, port->d_id); 2500 port->wwpn, port->d_id);
2446 retval = zfcp_erp_port_strategy_open_port(erp_action); 2501 retval = zfcp_erp_port_strategy_open_port(erp_action);
2447 break; 2502 break;
@@ -3092,9 +3147,9 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
3092 && port->rport) { 3147 && port->rport) {
3093 atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED, 3148 atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED,
3094 &unit->status); 3149 &unit->status);
3095 scsi_scan_target(&port->rport->dev, 0, 3150 if (atomic_test_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING,
3096 port->rport->scsi_target_id, 3151 &unit->status) == 0)
3097 unit->scsi_lun, 0); 3152 zfcp_erp_schedule_work(unit);
3098 } 3153 }
3099 zfcp_unit_put(unit); 3154 zfcp_unit_put(unit);
3100 break; 3155 break;
@@ -3121,7 +3176,7 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
3121 zfcp_get_busid_by_port(port), 3176 zfcp_get_busid_by_port(port),
3122 port->wwpn); 3177 port->wwpn);
3123 else { 3178 else {
3124 scsi_flush_work(adapter->scsi_host); 3179 scsi_target_unblock(&port->rport->dev);
3125 port->rport->maxframe_size = port->maxframe_size; 3180 port->rport->maxframe_size = port->maxframe_size;
3126 port->rport->supported_classes = 3181 port->rport->supported_classes =
3127 port->supported_classes; 3182 port->supported_classes;