X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fs390%2Fscsi%2Fzfcp_erp.c;h=ea2e7a398892a9a89f83a2adb4fb6525cbba7075;hb=ec4081c6ba4fba6a8bc12a0e93db8817ba63ce47;hp=da947e662031f6114b02121591b0f912ac41ff73;hpb=df080e7c94c8f4b8334614159fa079aaeece5670;p=linux-2.6 diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index da947e6620..ea2e7a3988 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -1,18 +1,8 @@ /* - * - * linux/drivers/s390/scsi/zfcp_erp.c - * - * FCP adapter driver for IBM eServer zSeries - * - * (C) Copyright IBM Corp. 2002, 2004 - * - * Author(s): Martin Peschke - * Raimund Schroeder - * Aron Zeh - * Wolfgang Taphorn - * Stefan Bader - * Heiko Carstens - * Andreas Herrmann + * This file is part of the zfcp device driver for + * FCP adapters for IBM System z9 and zSeries. + * + * (C) Copyright IBM Corp. 2002, 2006 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -231,13 +221,6 @@ zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear_mask) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ int zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask) { @@ -251,13 +234,6 @@ zfcp_erp_adapter_shutdown(struct zfcp_adapter *adapter, int clear_mask) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ int zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask) { @@ -271,13 +247,6 @@ zfcp_erp_port_shutdown(struct zfcp_port *port, int clear_mask) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ int zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear_mask) { @@ -306,20 +275,17 @@ zfcp_erp_adisc(struct zfcp_port *port) int retval = 0; struct timer_list *timer; - send_els = kmalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC); + send_els = kzalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC); if (send_els == NULL) goto nomem; - memset(send_els, 0, sizeof(*send_els)); - send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); + send_els->req = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); if (send_els->req == NULL) goto nomem; - memset(send_els->req, 0, sizeof(*send_els->req)); - send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC); + send_els->resp = kzalloc(sizeof(struct scatterlist), GFP_ATOMIC); if (send_els->resp == NULL) goto nomem; - memset(send_els->resp, 0, sizeof(*send_els->resp)); address = (void *) get_zeroed_page(GFP_ATOMIC); if (address == NULL) @@ -812,13 +778,6 @@ zfcp_erp_unit_unblock(struct zfcp_unit *unit) atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status); } -/* - * function: - * - * purpose: - * - * returns: - */ static void zfcp_erp_action_ready(struct zfcp_erp_action *erp_action) { @@ -1356,13 +1315,6 @@ zfcp_erp_strategy_check_action(struct zfcp_erp_action *erp_action, int retval) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action) { @@ -1538,13 +1490,6 @@ zfcp_erp_strategy_check_target(struct zfcp_erp_action *erp_action, int result) return result; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_statechange(int action, u32 status, @@ -1586,13 +1531,6 @@ zfcp_erp_strategy_statechange(int action, return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static inline int zfcp_erp_strategy_statechange_detected(atomic_t * target_status, u32 erp_status) { @@ -1605,13 +1543,6 @@ zfcp_erp_strategy_statechange_detected(atomic_t * target_status, u32 erp_status) !(ZFCP_STATUS_ERP_CLOSE_ONLY & erp_status)); } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) { @@ -1642,13 +1573,6 @@ zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result) return result; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) { @@ -1678,13 +1602,6 @@ zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) return result; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, int result) { @@ -1764,13 +1681,6 @@ zfcp_erp_strategy_followup_actions(int action, return 0; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_strategy_check_queues(struct zfcp_adapter *adapter) { @@ -1809,12 +1719,6 @@ zfcp_erp_wait(struct zfcp_adapter *adapter) return retval; } -/* - * function: zfcp_erp_modify_adapter_status - * - * purpose: - * - */ void zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, u32 mask, int set_or_clear) @@ -1919,13 +1823,6 @@ zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter, int clear_mask) return retval; } -/* - * function: - * - * purpose: - * - * returns: FIXME - */ static int zfcp_erp_port_reopen_all_internal(struct zfcp_adapter *adapter, int clear_mask) { @@ -2246,15 +2143,6 @@ zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) { int retval; - if ((atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, - &erp_action->adapter->status)) && - (erp_action->adapter->adapter_features & - FSF_FEATURE_HBAAPI_MANAGEMENT)) { - zfcp_erp_adapter_strategy_open_fsf_xport(erp_action); - atomic_set(&erp_action->adapter->erp_counter, 0); - return ZFCP_ERP_FAILED; - } - retval = zfcp_erp_adapter_strategy_open_fsf_xconfig(erp_action); if (retval == ZFCP_ERP_FAILED) return ZFCP_ERP_FAILED; @@ -2266,13 +2154,6 @@ zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *erp_action) return zfcp_erp_adapter_strategy_open_fsf_statusread(erp_action); } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action) { @@ -2350,57 +2231,42 @@ static int zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action) { int ret; - int retries; - int sleep; - struct zfcp_adapter *adapter = erp_action->adapter; + struct zfcp_adapter *adapter; + adapter = erp_action->adapter; atomic_clear_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status); - retries = 0; - do { - write_lock(&adapter->erp_lock); - zfcp_erp_action_to_running(erp_action); - write_unlock(&adapter->erp_lock); - zfcp_erp_timeout_init(erp_action); - ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL); - if (ret == -EOPNOTSUPP) { - debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); - return ZFCP_ERP_SUCCEEDED; - } else if (ret) { - debug_text_event(adapter->erp_dbf, 3, "a_xport_failed"); - return ZFCP_ERP_FAILED; - } - debug_text_event(adapter->erp_dbf, 6, "a_xport_ok"); + write_lock(&adapter->erp_lock); + zfcp_erp_action_to_running(erp_action); + write_unlock(&adapter->erp_lock); - down(&adapter->erp_ready_sem); - if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { - ZFCP_LOG_INFO("error: exchange of port data " - "for adapter %s timed out\n", - zfcp_get_busid_by_adapter(adapter)); - break; - } - if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, - &adapter->status)) - break; + zfcp_erp_timeout_init(erp_action); + ret = zfcp_fsf_exchange_port_data(erp_action, adapter, NULL); + if (ret == -EOPNOTSUPP) { + debug_text_event(adapter->erp_dbf, 3, "a_xport_notsupp"); + return ZFCP_ERP_SUCCEEDED; + } else if (ret) { + debug_text_event(adapter->erp_dbf, 3, "a_xport_failed"); + return ZFCP_ERP_FAILED; + } + debug_text_event(adapter->erp_dbf, 6, "a_xport_ok"); - if (retries < ZFCP_EXCHANGE_PORT_DATA_SHORT_RETRIES) { - sleep = ZFCP_EXCHANGE_PORT_DATA_SHORT_SLEEP; - retries++; - } else - sleep = ZFCP_EXCHANGE_PORT_DATA_LONG_SLEEP; - schedule_timeout(sleep); - } while (1); + ret = ZFCP_ERP_SUCCEEDED; + down(&adapter->erp_ready_sem); + if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { + ZFCP_LOG_INFO("error: exchange port data timed out (adapter " + "%s)\n", zfcp_get_busid_by_adapter(adapter)); + ret = ZFCP_ERP_FAILED; + } + if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status)) { + ZFCP_LOG_INFO("error: exchange port data failed (adapter " + "%s\n", zfcp_get_busid_by_adapter(adapter)); + ret = ZFCP_ERP_FAILED; + } - return ZFCP_ERP_SUCCEEDED; + return ret; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_adapter_strategy_open_fsf_statusread(struct zfcp_erp_action *erp_action) @@ -2569,13 +2435,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_port_strategy_open(struct zfcp_erp_action *erp_action) { @@ -2590,15 +2449,6 @@ zfcp_erp_port_strategy_open(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - * - * FIXME(design): currently only prepared for fabric (nameserver!) - */ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) { @@ -2714,13 +2564,6 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action) { @@ -2837,13 +2680,6 @@ zfcp_erp_port_forced_strategy_close(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_port_strategy_clearstati(struct zfcp_port *port) { @@ -3046,13 +2882,6 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_unit_strategy_clearstati(struct zfcp_unit *unit) { @@ -3153,13 +2982,6 @@ zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action) return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static inline void zfcp_erp_timeout_init(struct zfcp_erp_action *erp_action) { @@ -3355,13 +3177,6 @@ zfcp_erp_action_enqueue(int action, return retval; } -/* - * function: - * - * purpose: - * - * returns: - */ static int zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action) { @@ -3415,10 +3230,13 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, && (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY, &unit->status)) && !unit->device - && port->rport) - scsi_add_device(port->adapter->scsi_host, 0, - port->rport->scsi_target_id, - unit->scsi_lun); + && port->rport) { + atomic_set_mask(ZFCP_STATUS_UNIT_REGISTERED, + &unit->status); + scsi_scan_target(&port->rport->dev, 0, + port->rport->scsi_target_id, + unit->scsi_lun, 0); + } zfcp_unit_put(unit); break; case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: @@ -3439,6 +3257,8 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, "(adapter %s, wwpn=0x%016Lx)\n", zfcp_get_busid_by_port(port), port->wwpn); + else + scsi_flush_work(adapter->scsi_host); } zfcp_port_put(port); break; @@ -3451,13 +3271,6 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, } -/* - * function: - * - * purpose: - * - * returns: FIXME - */ static int zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter) { @@ -3474,13 +3287,6 @@ zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter) return retval; } -/* - * function: - * - * purpose: - * - * returns: FIXME - */ static int zfcp_erp_action_dismiss_port(struct zfcp_port *port) { @@ -3499,13 +3305,6 @@ zfcp_erp_action_dismiss_port(struct zfcp_port *port) return retval; } -/* - * function: - * - * purpose: - * - * returns: FIXME - */ static int zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit) { @@ -3520,13 +3319,6 @@ zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit) return retval; } -/* - * function: - * - * purpose: moves erp_action to 'erp running list' - * - * returns: - */ static inline void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) { @@ -3537,13 +3329,6 @@ zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action) list_move(&erp_action->list, &erp_action->adapter->erp_running_head); } -/* - * function: - * - * purpose: moves erp_action to 'erp ready list' - * - * returns: - */ static inline void zfcp_erp_action_to_ready(struct zfcp_erp_action *erp_action) { @@ -3554,11 +3339,6 @@ zfcp_erp_action_to_ready(struct zfcp_erp_action *erp_action) list_move(&erp_action->list, &erp_action->adapter->erp_ready_head); } -/* - * function: zfcp_erp_port_boxed - * - * purpose: - */ void zfcp_erp_port_boxed(struct zfcp_port *port) { @@ -3575,11 +3355,6 @@ zfcp_erp_port_boxed(struct zfcp_port *port) zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED); } -/* - * function: zfcp_erp_unit_boxed - * - * purpose: - */ void zfcp_erp_unit_boxed(struct zfcp_unit *unit) { @@ -3593,11 +3368,6 @@ zfcp_erp_unit_boxed(struct zfcp_unit *unit) zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED); } -/* - * function: zfcp_erp_port_access_denied - * - * purpose: - */ void zfcp_erp_port_access_denied(struct zfcp_port *port) { @@ -3614,11 +3384,6 @@ zfcp_erp_port_access_denied(struct zfcp_port *port) read_unlock_irqrestore(&zfcp_data.config_lock, flags); } -/* - * function: zfcp_erp_unit_access_denied - * - * purpose: - */ void zfcp_erp_unit_access_denied(struct zfcp_unit *unit) { @@ -3632,11 +3397,6 @@ zfcp_erp_unit_access_denied(struct zfcp_unit *unit) ZFCP_SET); } -/* - * function: zfcp_erp_adapter_access_changed - * - * purpose: - */ void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) { @@ -3658,11 +3418,6 @@ zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter) read_unlock_irqrestore(&zfcp_data.config_lock, flags); } -/* - * function: zfcp_erp_port_access_changed - * - * purpose: - */ void zfcp_erp_port_access_changed(struct zfcp_port *port) { @@ -3691,11 +3446,6 @@ zfcp_erp_port_access_changed(struct zfcp_port *port) zfcp_get_busid_by_adapter(adapter), port->wwpn); } -/* - * function: zfcp_erp_unit_access_changed - * - * purpose: - */ void zfcp_erp_unit_access_changed(struct zfcp_unit *unit) {