aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_erp.c
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2005-06-20 12:35:34 -0400
committerTony Luck <tony.luck@intel.com>2005-06-20 12:35:34 -0400
commit8ba08378b479f472b37b83542c31bdad465033cf (patch)
treef4421227b3065e786c9041cf0ce0073a249e011b /drivers/s390/scsi/zfcp_erp.c
parent34b727c135ff651f153be5757056d25678b6d018 (diff)
parent8b22c249e7de453961e4d253b19fc2a0bdd65d53 (diff)
Auto merge with /home/aegl/GIT/linus
Diffstat (limited to 'drivers/s390/scsi/zfcp_erp.c')
-rw-r--r--drivers/s390/scsi/zfcp_erp.c121
1 files changed, 83 insertions, 38 deletions
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 53ebc1cdfe2d..0cf31f7d1c0f 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -35,7 +35,7 @@
35 35
36#include "zfcp_ext.h" 36#include "zfcp_ext.h"
37 37
38static int zfcp_erp_adisc(struct zfcp_adapter *, fc_id_t); 38static int zfcp_erp_adisc(struct zfcp_port *);
39static void zfcp_erp_adisc_handler(unsigned long); 39static void zfcp_erp_adisc_handler(unsigned long);
40 40
41static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int); 41static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int);
@@ -295,12 +295,12 @@ zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask)
295 295
296/** 296/**
297 * zfcp_erp_adisc - send ADISC ELS command 297 * zfcp_erp_adisc - send ADISC ELS command
298 * @adapter: adapter structure 298 * @port: port structure
299 * @d_id: d_id of port where ADISC is sent to
300 */ 299 */
301int 300int
302zfcp_erp_adisc(struct zfcp_adapter *adapter, fc_id_t d_id) 301zfcp_erp_adisc(struct zfcp_port *port)
303{ 302{
303 struct zfcp_adapter *adapter = port->adapter;
304 struct zfcp_send_els *send_els; 304 struct zfcp_send_els *send_els;
305 struct zfcp_ls_adisc *adisc; 305 struct zfcp_ls_adisc *adisc;
306 void *address = NULL; 306 void *address = NULL;
@@ -332,7 +332,8 @@ zfcp_erp_adisc(struct zfcp_adapter *adapter, fc_id_t d_id)
332 send_els->req_count = send_els->resp_count = 1; 332 send_els->req_count = send_els->resp_count = 1;
333 333
334 send_els->adapter = adapter; 334 send_els->adapter = adapter;
335 send_els->d_id = d_id; 335 send_els->port = port;
336 send_els->d_id = port->d_id;
336 send_els->handler = zfcp_erp_adisc_handler; 337 send_els->handler = zfcp_erp_adisc_handler;
337 send_els->handler_data = (unsigned long) send_els; 338 send_els->handler_data = (unsigned long) send_els;
338 339
@@ -350,7 +351,7 @@ zfcp_erp_adisc(struct zfcp_adapter *adapter, fc_id_t d_id)
350 ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x " 351 ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x "
351 "(wwpn=0x%016Lx, wwnn=0x%016Lx, " 352 "(wwpn=0x%016Lx, wwnn=0x%016Lx, "
352 "hard_nport_id=0x%08x, nport_id=0x%08x)\n", 353 "hard_nport_id=0x%08x, nport_id=0x%08x)\n",
353 adapter->s_id, d_id, (wwn_t) adisc->wwpn, 354 adapter->s_id, send_els->d_id, (wwn_t) adisc->wwpn,
354 (wwn_t) adisc->wwnn, adisc->hard_nport_id, 355 (wwn_t) adisc->wwnn, adisc->hard_nport_id,
355 adisc->nport_id); 356 adisc->nport_id);
356 357
@@ -367,7 +368,7 @@ zfcp_erp_adisc(struct zfcp_adapter *adapter, fc_id_t d_id)
367 retval = zfcp_fsf_send_els(send_els); 368 retval = zfcp_fsf_send_els(send_els);
368 if (retval != 0) { 369 if (retval != 0) {
369 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port " 370 ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port "
370 "0x%08x on adapter %s\n", d_id, 371 "0x%08x on adapter %s\n", send_els->d_id,
371 zfcp_get_busid_by_adapter(adapter)); 372 zfcp_get_busid_by_adapter(adapter));
372 del_timer(send_els->timer); 373 del_timer(send_els->timer);
373 goto freemem; 374 goto freemem;
@@ -411,14 +412,9 @@ zfcp_erp_adisc_handler(unsigned long data)
411 del_timer(send_els->timer); 412 del_timer(send_els->timer);
412 413
413 adapter = send_els->adapter; 414 adapter = send_els->adapter;
415 port = send_els->port;
414 d_id = send_els->d_id; 416 d_id = send_els->d_id;
415 417
416 read_lock(&zfcp_data.config_lock);
417 port = zfcp_get_port_by_did(send_els->adapter, send_els->d_id);
418 read_unlock(&zfcp_data.config_lock);
419
420 BUG_ON(port == NULL);
421
422 /* request rejected or timed out */ 418 /* request rejected or timed out */
423 if (send_els->status != 0) { 419 if (send_els->status != 0) {
424 ZFCP_LOG_NORMAL("ELS request rejected/timed out, " 420 ZFCP_LOG_NORMAL("ELS request rejected/timed out, "
@@ -482,7 +478,7 @@ zfcp_test_link(struct zfcp_port *port)
482 int retval; 478 int retval;
483 479
484 zfcp_port_get(port); 480 zfcp_port_get(port);
485 retval = zfcp_erp_adisc(port->adapter, port->d_id); 481 retval = zfcp_erp_adisc(port);
486 if (retval != 0) { 482 if (retval != 0) {
487 zfcp_port_put(port); 483 zfcp_port_put(port);
488 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx " 484 ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx "
@@ -895,7 +891,7 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
895 891
896 if (erp_action->fsf_req) { 892 if (erp_action->fsf_req) {
897 /* take lock to ensure that request is not being deleted meanwhile */ 893 /* take lock to ensure that request is not being deleted meanwhile */
898 write_lock(&adapter->fsf_req_list_lock); 894 spin_lock(&adapter->fsf_req_list_lock);
899 /* check whether fsf req does still exist */ 895 /* check whether fsf req does still exist */
900 list_for_each_entry(fsf_req, &adapter->fsf_req_list_head, list) 896 list_for_each_entry(fsf_req, &adapter->fsf_req_list_head, list)
901 if (fsf_req == erp_action->fsf_req) 897 if (fsf_req == erp_action->fsf_req)
@@ -938,7 +934,7 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
938 */ 934 */
939 erp_action->fsf_req = NULL; 935 erp_action->fsf_req = NULL;
940 } 936 }
941 write_unlock(&adapter->fsf_req_list_lock); 937 spin_unlock(&adapter->fsf_req_list_lock);
942 } else 938 } else
943 debug_text_event(adapter->erp_dbf, 3, "a_ca_noreq"); 939 debug_text_event(adapter->erp_dbf, 3, "a_ca_noreq");
944 940
@@ -2286,12 +2282,12 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
2286{ 2282{
2287 int retval = ZFCP_ERP_SUCCEEDED; 2283 int retval = ZFCP_ERP_SUCCEEDED;
2288 int retries; 2284 int retries;
2285 int sleep = ZFCP_EXCHANGE_CONFIG_DATA_FIRST_SLEEP;
2289 struct zfcp_adapter *adapter = erp_action->adapter; 2286 struct zfcp_adapter *adapter = erp_action->adapter;
2290 2287
2291 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, &adapter->status); 2288 atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, &adapter->status);
2292 retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES;
2293 2289
2294 do { 2290 for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) {
2295 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 2291 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
2296 &adapter->status); 2292 &adapter->status);
2297 ZFCP_LOG_DEBUG("Doing exchange config data\n"); 2293 ZFCP_LOG_DEBUG("Doing exchange config data\n");
@@ -2329,16 +2325,17 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
2329 zfcp_get_busid_by_adapter(adapter)); 2325 zfcp_get_busid_by_adapter(adapter));
2330 break; 2326 break;
2331 } 2327 }
2332 if (atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 2328
2333 &adapter->status)) { 2329 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
2334 ZFCP_LOG_DEBUG("host connection still initialising... " 2330 &adapter->status))
2335 "waiting and retrying...\n"); 2331 break;
2336 /* sleep a little bit before retry */ 2332
2337 msleep(jiffies_to_msecs(ZFCP_EXCHANGE_CONFIG_DATA_SLEEP)); 2333 ZFCP_LOG_DEBUG("host connection still initialising... "
2338 } 2334 "waiting and retrying...\n");
2339 } while ((retries--) && 2335 /* sleep a little bit before retry */
2340 atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 2336 msleep(jiffies_to_msecs(sleep));
2341 &adapter->status)); 2337 sleep *= 2;
2338 }
2342 2339
2343 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, 2340 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
2344 &adapter->status)) { 2341 &adapter->status)) {
@@ -3485,6 +3482,45 @@ zfcp_erp_action_to_ready(struct zfcp_erp_action *erp_action)
3485} 3482}
3486 3483
3487/* 3484/*
3485 * function: zfcp_erp_port_boxed
3486 *
3487 * purpose:
3488 */
3489void
3490zfcp_erp_port_boxed(struct zfcp_port *port)
3491{
3492 struct zfcp_adapter *adapter = port->adapter;
3493 unsigned long flags;
3494
3495 debug_text_event(adapter->erp_dbf, 3, "p_access_boxed");
3496 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
3497 read_lock_irqsave(&zfcp_data.config_lock, flags);
3498 zfcp_erp_modify_port_status(port,
3499 ZFCP_STATUS_COMMON_ACCESS_BOXED,
3500 ZFCP_SET);
3501 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3502 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED);
3503}
3504
3505/*
3506 * function: zfcp_erp_unit_boxed
3507 *
3508 * purpose:
3509 */
3510void
3511zfcp_erp_unit_boxed(struct zfcp_unit *unit)
3512{
3513 struct zfcp_adapter *adapter = unit->port->adapter;
3514
3515 debug_text_event(adapter->erp_dbf, 3, "u_access_boxed");
3516 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
3517 zfcp_erp_modify_unit_status(unit,
3518 ZFCP_STATUS_COMMON_ACCESS_BOXED,
3519 ZFCP_SET);
3520 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED);
3521}
3522
3523/*
3488 * function: zfcp_erp_port_access_denied 3524 * function: zfcp_erp_port_access_denied
3489 * 3525 *
3490 * purpose: 3526 * purpose:
@@ -3495,11 +3531,13 @@ zfcp_erp_port_access_denied(struct zfcp_port *port)
3495 struct zfcp_adapter *adapter = port->adapter; 3531 struct zfcp_adapter *adapter = port->adapter;
3496 unsigned long flags; 3532 unsigned long flags;
3497 3533
3498 debug_text_event(adapter->erp_dbf, 3, "p_access_block"); 3534 debug_text_event(adapter->erp_dbf, 3, "p_access_denied");
3499 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); 3535 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
3500 read_lock_irqsave(&zfcp_data.config_lock, flags); 3536 read_lock_irqsave(&zfcp_data.config_lock, flags);
3501 zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED | 3537 zfcp_erp_modify_port_status(port,
3502 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3538 ZFCP_STATUS_COMMON_ERP_FAILED |
3539 ZFCP_STATUS_COMMON_ACCESS_DENIED,
3540 ZFCP_SET);
3503 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 3541 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
3504} 3542}
3505 3543
@@ -3513,10 +3551,12 @@ zfcp_erp_unit_access_denied(struct zfcp_unit *unit)
3513{ 3551{
3514 struct zfcp_adapter *adapter = unit->port->adapter; 3552 struct zfcp_adapter *adapter = unit->port->adapter;
3515 3553
3516 debug_text_event(adapter->erp_dbf, 3, "u_access_block"); 3554 debug_text_event(adapter->erp_dbf, 3, "u_access_denied");
3517 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3555 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
3518 zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_ERP_FAILED | 3556 zfcp_erp_modify_unit_status(unit,
3519 ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); 3557 ZFCP_STATUS_COMMON_ERP_FAILED |
3558 ZFCP_STATUS_COMMON_ACCESS_DENIED,
3559 ZFCP_SET);
3520} 3560}
3521 3561
3522/* 3562/*
@@ -3530,7 +3570,7 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
3530 struct zfcp_port *port; 3570 struct zfcp_port *port;
3531 unsigned long flags; 3571 unsigned long flags;
3532 3572
3533 debug_text_event(adapter->erp_dbf, 3, "a_access_unblock"); 3573 debug_text_event(adapter->erp_dbf, 3, "a_access_recover");
3534 debug_event(adapter->erp_dbf, 3, &adapter->name, 8); 3574 debug_event(adapter->erp_dbf, 3, &adapter->name, 8);
3535 3575
3536 read_lock_irqsave(&zfcp_data.config_lock, flags); 3576 read_lock_irqsave(&zfcp_data.config_lock, flags);
@@ -3553,10 +3593,12 @@ zfcp_erp_port_access_changed(struct zfcp_port *port)
3553 struct zfcp_adapter *adapter = port->adapter; 3593 struct zfcp_adapter *adapter = port->adapter;
3554 struct zfcp_unit *unit; 3594 struct zfcp_unit *unit;
3555 3595
3556 debug_text_event(adapter->erp_dbf, 3, "p_access_unblock"); 3596 debug_text_event(adapter->erp_dbf, 3, "p_access_recover");
3557 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t)); 3597 debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
3558 3598
3559 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 3599 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
3600 &port->status) &&
3601 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
3560 &port->status)) { 3602 &port->status)) {
3561 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 3603 if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
3562 list_for_each_entry(unit, &port->unit_list_head, list) 3604 list_for_each_entry(unit, &port->unit_list_head, list)
@@ -3583,10 +3625,13 @@ zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
3583{ 3625{
3584 struct zfcp_adapter *adapter = unit->port->adapter; 3626 struct zfcp_adapter *adapter = unit->port->adapter;
3585 3627
3586 debug_text_event(adapter->erp_dbf, 3, "u_access_unblock"); 3628 debug_text_event(adapter->erp_dbf, 3, "u_access_recover");
3587 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t)); 3629 debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
3588 3630
3589 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status)) 3631 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
3632 &unit->status) &&
3633 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
3634 &unit->status))
3590 return; 3635 return;
3591 3636
3592 ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx " 3637 ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "