Commit edaed859 authored by Swen Schillig's avatar Swen Schillig Committed by James Bottomley

[SCSI] zfcp: Replace status modifier functions.

Replace the zfcp_modify_<xxx>_status functions and its accompanying wrappers
with dedicated status modifier functions. This eases code readability and
maintenance.
Signed-off-by: default avatarSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: default avatarChristof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent c9ff5d03
...@@ -46,8 +46,7 @@ static int zfcp_ccw_activate(struct ccw_device *cdev) ...@@ -46,8 +46,7 @@ static int zfcp_ccw_activate(struct ccw_device *cdev)
if (!adapter) if (!adapter)
return 0; return 0;
zfcp_erp_modify_adapter_status(adapter, "ccresu1", NULL, zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
"ccresu2", NULL); "ccresu2", NULL);
zfcp_erp_wait(adapter); zfcp_erp_wait(adapter);
...@@ -217,9 +216,8 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event) ...@@ -217,9 +216,8 @@ static int zfcp_ccw_notify(struct ccw_device *cdev, int event)
break; break;
case CIO_OPER: case CIO_OPER:
dev_info(&cdev->dev, "The FCP device is operational again\n"); dev_info(&cdev->dev, "The FCP device is operational again\n");
zfcp_erp_modify_adapter_status(adapter, "ccnoti3", NULL, zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
"ccnoti4", NULL); "ccnoti4", NULL);
break; break;
......
...@@ -328,9 +328,9 @@ void zfcp_cfdc_port_denied(struct zfcp_port *port, ...@@ -328,9 +328,9 @@ void zfcp_cfdc_port_denied(struct zfcp_port *port,
zfcp_act_eval_err(port->adapter, qual->halfword[0]); zfcp_act_eval_err(port->adapter, qual->halfword[0]);
zfcp_act_eval_err(port->adapter, qual->halfword[1]); zfcp_act_eval_err(port->adapter, qual->halfword[1]);
zfcp_erp_modify_port_status(port, "cfadp_1", NULL, zfcp_erp_set_port_status(port,
ZFCP_STATUS_COMMON_ERP_FAILED | ZFCP_STATUS_COMMON_ERP_FAILED |
ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); ZFCP_STATUS_COMMON_ACCESS_DENIED);
} }
/** /**
...@@ -349,9 +349,9 @@ void zfcp_cfdc_lun_denied(struct scsi_device *sdev, ...@@ -349,9 +349,9 @@ void zfcp_cfdc_lun_denied(struct scsi_device *sdev,
(unsigned long long)zfcp_sdev->port->wwpn); (unsigned long long)zfcp_sdev->port->wwpn);
zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[0]); zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[0]);
zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[1]); zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->halfword[1]);
zfcp_erp_modify_lun_status(sdev, "cfadl_1", NULL, zfcp_erp_set_lun_status(sdev,
ZFCP_STATUS_COMMON_ERP_FAILED | ZFCP_STATUS_COMMON_ERP_FAILED |
ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); ZFCP_STATUS_COMMON_ACCESS_DENIED);
atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
...@@ -378,9 +378,9 @@ void zfcp_cfdc_lun_shrng_vltn(struct scsi_device *sdev, ...@@ -378,9 +378,9 @@ void zfcp_cfdc_lun_shrng_vltn(struct scsi_device *sdev,
else else
zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->word[2]); zfcp_act_eval_err(zfcp_sdev->port->adapter, qual->word[2]);
zfcp_erp_modify_lun_status(sdev, "fsosh_3", NULL, zfcp_erp_set_lun_status(sdev,
ZFCP_STATUS_COMMON_ERP_FAILED | ZFCP_STATUS_COMMON_ERP_FAILED |
ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET); ZFCP_STATUS_COMMON_ACCESS_DENIED);
atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status); atomic_clear_mask(ZFCP_STATUS_LUN_SHARED, &zfcp_sdev->status);
atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status); atomic_clear_mask(ZFCP_STATUS_LUN_READONLY, &zfcp_sdev->status);
} }
...@@ -424,7 +424,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev, ...@@ -424,7 +424,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev,
"not supported (LUN 0x%016Lx, port 0x%016Lx)\n", "not supported (LUN 0x%016Lx, port 0x%016Lx)\n",
zfcp_scsi_dev_lun(sdev), zfcp_scsi_dev_lun(sdev),
(unsigned long long)zfcp_sdev->port->wwpn); (unsigned long long)zfcp_sdev->port->wwpn);
zfcp_erp_lun_failed(sdev, "fsosh_5", NULL); zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_lun_shutdown(sdev, 0, "fsouh_6", NULL); zfcp_erp_lun_shutdown(sdev, 0, "fsouh_6", NULL);
return -EACCES; return -EACCES;
} }
...@@ -435,7 +435,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev, ...@@ -435,7 +435,7 @@ int zfcp_cfdc_open_lun_eval(struct scsi_device *sdev,
"(LUN 0x%016Lx, port 0x%016Lx)\n", "(LUN 0x%016Lx, port 0x%016Lx)\n",
zfcp_scsi_dev_lun(sdev), zfcp_scsi_dev_lun(sdev),
(unsigned long long)zfcp_sdev->port->wwpn); (unsigned long long)zfcp_sdev->port->wwpn);
zfcp_erp_lun_failed(sdev, "fsosh_7", NULL); zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
zfcp_erp_lun_shutdown(sdev, 0, "fsosh_8", NULL); zfcp_erp_lun_shutdown(sdev, 0, "fsosh_8", NULL);
return -EACCES; return -EACCES;
} }
......
...@@ -325,9 +325,4 @@ struct zfcp_data { ...@@ -325,9 +325,4 @@ struct zfcp_data {
struct kmem_cache *adisc_cache; struct kmem_cache *adisc_cache;
}; };
/********************** ZFCP SPECIFIC DEFINES ********************************/
#define ZFCP_SET 0x00000100
#define ZFCP_CLEAR 0x00000200
#endif /* ZFCP_DEF_H */ #endif /* ZFCP_DEF_H */
...@@ -57,9 +57,8 @@ enum zfcp_erp_act_result { ...@@ -57,9 +57,8 @@ enum zfcp_erp_act_result {
static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask) static void zfcp_erp_adapter_block(struct zfcp_adapter *adapter, int mask)
{ {
zfcp_erp_modify_adapter_status(adapter, "erablk1", NULL, zfcp_erp_clear_adapter_status(adapter,
ZFCP_STATUS_COMMON_UNBLOCKED | mask, ZFCP_STATUS_COMMON_UNBLOCKED | mask);
ZFCP_CLEAR);
} }
static int zfcp_erp_action_exists(struct zfcp_erp_action *act) static int zfcp_erp_action_exists(struct zfcp_erp_action *act)
...@@ -266,7 +265,8 @@ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, ...@@ -266,7 +265,8 @@ static int _zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter,
/* ensure propagation of failed status to new devices */ /* ensure propagation of failed status to new devices */
if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
zfcp_erp_adapter_failed(adapter, "erareo1", NULL); zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_ERP_FAILED);
return -EIO; return -EIO;
} }
return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, return zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER,
...@@ -290,7 +290,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear, ...@@ -290,7 +290,8 @@ void zfcp_erp_adapter_reopen(struct zfcp_adapter *adapter, int clear,
write_lock_irqsave(&adapter->erp_lock, flags); write_lock_irqsave(&adapter->erp_lock, flags);
if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED) if (atomic_read(&adapter->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
zfcp_erp_adapter_failed(adapter, "erareo1", NULL); zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_ERP_FAILED);
else else
zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter, zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_ADAPTER, adapter,
NULL, NULL, id, ref, 0); NULL, NULL, id, ref, 0);
...@@ -327,9 +328,8 @@ void zfcp_erp_port_shutdown(struct zfcp_port *port, int clear, char *id, ...@@ -327,9 +328,8 @@ void zfcp_erp_port_shutdown(struct zfcp_port *port, int clear, char *id,
static void zfcp_erp_port_block(struct zfcp_port *port, int clear) static void zfcp_erp_port_block(struct zfcp_port *port, int clear)
{ {
zfcp_erp_modify_port_status(port, "erpblk1", NULL, zfcp_erp_clear_port_status(port,
ZFCP_STATUS_COMMON_UNBLOCKED | clear, ZFCP_STATUS_COMMON_UNBLOCKED | clear);
ZFCP_CLEAR);
} }
static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port, static void _zfcp_erp_port_forced_reopen(struct zfcp_port *port,
...@@ -370,7 +370,7 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, ...@@ -370,7 +370,7 @@ static int _zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id,
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) { if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
/* ensure propagation of failed status to new devices */ /* ensure propagation of failed status to new devices */
zfcp_erp_port_failed(port, "erpreo1", NULL); zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
return -EIO; return -EIO;
} }
...@@ -400,9 +400,8 @@ int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref) ...@@ -400,9 +400,8 @@ int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref)
static void zfcp_erp_lun_block(struct scsi_device *sdev, int clear_mask) static void zfcp_erp_lun_block(struct scsi_device *sdev, int clear_mask)
{ {
zfcp_erp_modify_lun_status(sdev, "erlblk1", NULL, zfcp_erp_clear_lun_status(sdev,
ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask, ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask);
ZFCP_CLEAR);
} }
static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id, static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
...@@ -483,11 +482,6 @@ static int status_change_set(unsigned long mask, atomic_t *status) ...@@ -483,11 +482,6 @@ static int status_change_set(unsigned long mask, atomic_t *status)
return (atomic_read(status) ^ mask) & mask; return (atomic_read(status) ^ mask) & mask;
} }
static int status_change_clear(unsigned long mask, atomic_t *status)
{
return atomic_read(status) & mask;
}
static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter) static void zfcp_erp_adapter_unblock(struct zfcp_adapter *adapter)
{ {
if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status)) if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->status))
...@@ -779,8 +773,7 @@ static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act) ...@@ -779,8 +773,7 @@ static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act)
adapter->fsf_req_seq_no = 0; adapter->fsf_req_seq_no = 0;
zfcp_fc_wka_ports_force_offline(adapter->gs); zfcp_fc_wka_ports_force_offline(adapter->gs);
/* all ports and LUNs are closed */ /* all ports and LUNs are closed */
zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL, zfcp_erp_clear_adapter_status(adapter, ZFCP_STATUS_COMMON_OPEN);
ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK | atomic_clear_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK |
ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status); ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED, &adapter->status);
...@@ -897,7 +890,7 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act) ...@@ -897,7 +890,7 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act)
struct zfcp_port *port = act->port; struct zfcp_port *port = act->port;
if (port->wwpn != adapter->peer_wwpn) { if (port->wwpn != adapter->peer_wwpn) {
zfcp_erp_port_failed(port, "eroptp1", NULL); zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
return ZFCP_ERP_FAILED; return ZFCP_ERP_FAILED;
} }
port->d_id = adapter->peer_d_id; port->d_id = adapter->peer_d_id;
...@@ -1042,7 +1035,8 @@ static int zfcp_erp_strategy_check_lun(struct scsi_device *sdev, int result) ...@@ -1042,7 +1035,8 @@ static int zfcp_erp_strategy_check_lun(struct scsi_device *sdev, int result)
"port 0x%016Lx\n", "port 0x%016Lx\n",
(unsigned long long)zfcp_scsi_dev_lun(sdev), (unsigned long long)zfcp_scsi_dev_lun(sdev),
(unsigned long long)zfcp_sdev->port->wwpn); (unsigned long long)zfcp_sdev->port->wwpn);
zfcp_erp_lun_failed(sdev, "ersckl1", NULL); zfcp_erp_set_lun_status(sdev,
ZFCP_STATUS_COMMON_ERP_FAILED);
} }
break; break;
} }
...@@ -1072,7 +1066,8 @@ static int zfcp_erp_strategy_check_port(struct zfcp_port *port, int result) ...@@ -1072,7 +1066,8 @@ static int zfcp_erp_strategy_check_port(struct zfcp_port *port, int result)
dev_err(&port->adapter->ccw_device->dev, dev_err(&port->adapter->ccw_device->dev,
"ERP failed for remote port 0x%016Lx\n", "ERP failed for remote port 0x%016Lx\n",
(unsigned long long)port->wwpn); (unsigned long long)port->wwpn);
zfcp_erp_port_failed(port, "erpsck1", NULL); zfcp_erp_set_port_status(port,
ZFCP_STATUS_COMMON_ERP_FAILED);
} }
break; break;
} }
...@@ -1099,7 +1094,8 @@ static int zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter, ...@@ -1099,7 +1094,8 @@ static int zfcp_erp_strategy_check_adapter(struct zfcp_adapter *adapter,
dev_err(&adapter->ccw_device->dev, dev_err(&adapter->ccw_device->dev,
"ERP cannot recover an error " "ERP cannot recover an error "
"on the FCP device\n"); "on the FCP device\n");
zfcp_erp_adapter_failed(adapter, "erasck1", NULL); zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_ERP_FAILED);
} }
break; break;
} }
...@@ -1421,175 +1417,159 @@ void zfcp_erp_thread_kill(struct zfcp_adapter *adapter) ...@@ -1421,175 +1417,159 @@ void zfcp_erp_thread_kill(struct zfcp_adapter *adapter)
} }
/** /**
* zfcp_erp_adapter_failed - Set adapter status to failed. * zfcp_erp_wait - wait for completion of error recovery on an adapter
* @adapter: Failed adapter. * @adapter: adapter for which to wait for completion of its error recovery
* @id: Event id for debug trace.
* @ref: Reference for debug trace.
*/ */
void zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, char *id, void *ref) void zfcp_erp_wait(struct zfcp_adapter *adapter)
{ {
zfcp_erp_modify_adapter_status(adapter, id, ref, wait_event(adapter->erp_done_wqh,
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); !(atomic_read(&adapter->status) &
ZFCP_STATUS_ADAPTER_ERP_PENDING));
} }
/** /**
* zfcp_erp_port_failed - Set port status to failed. * zfcp_erp_set_adapter_status - set adapter status bits
* @port: Failed port. * @adapter: adapter to change the status
* @id: Event id for debug trace. * @mask: status bits to change
* @ref: Reference for debug trace. *
* Changes in common status bits are propagated to attached ports and LUNs.
*/ */
void zfcp_erp_port_failed(struct zfcp_port *port, char *id, void *ref) void zfcp_erp_set_adapter_status(struct zfcp_adapter *adapter, u32 mask)
{ {
zfcp_erp_modify_port_status(port, id, ref, struct zfcp_port *port;
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); struct scsi_device *sdev;
} unsigned long flags;
u32 common_mask = mask & ZFCP_COMMON_FLAGS;
/** atomic_set_mask(mask, &adapter->status);
* zfcp_erp_lun_failed - Set LUN status to failed.
* @sdev: Failed SCSI device / LUN
* @id: Event id for debug trace.
* @ref: Reference for debug trace.
*/
void zfcp_erp_lun_failed(struct scsi_device *sdev, char *id, void *ref)
{
zfcp_erp_modify_lun_status(sdev, id, ref,
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
}
/** if (!common_mask)
* zfcp_erp_wait - wait for completion of error recovery on an adapter return;
* @adapter: adapter for which to wait for completion of its error recovery
*/ read_lock_irqsave(&adapter->port_list_lock, flags);
void zfcp_erp_wait(struct zfcp_adapter *adapter) list_for_each_entry(port, &adapter->port_list, list)
{ atomic_set_mask(common_mask, &port->status);
wait_event(adapter->erp_done_wqh, read_unlock_irqrestore(&adapter->port_list_lock, flags);
!(atomic_read(&adapter->status) &
ZFCP_STATUS_ADAPTER_ERP_PENDING)); shost_for_each_device(sdev, adapter->scsi_host)
atomic_set_mask(common_mask, &sdev_to_zfcp(sdev)->status);
} }
/** /**
* zfcp_erp_modify_adapter_status - change adapter status bits * zfcp_erp_clear_adapter_status - clear adapter status bits
* @adapter: adapter to change the status * @adapter: adapter to change the status
* @id: id for the debug trace
* @ref: reference for the debug trace
* @mask: status bits to change * @mask: status bits to change
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
* *
* Changes in common status bits are propagated to attached ports and LUNs. * Changes in common status bits are propagated to attached ports and LUNs.
*/ */
void zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, char *id, void zfcp_erp_clear_adapter_status(struct zfcp_adapter *adapter, u32 mask)
void *ref, u32 mask, int set_or_clear)
{ {
struct zfcp_port *port; struct zfcp_port *port;
struct scsi_device *sdev;
unsigned long flags; unsigned long flags;
u32 common_mask = mask & ZFCP_COMMON_FLAGS; u32 common_mask = mask & ZFCP_COMMON_FLAGS;
u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
if (set_or_clear == ZFCP_SET) { atomic_clear_mask(mask, &adapter->status);
if (status_change_set(mask, &adapter->status))
zfcp_dbf_rec_adapter(id, ref, adapter->dbf); if (!common_mask)
atomic_set_mask(mask, &adapter->status); return;
} else {
if (status_change_clear(mask, &adapter->status)) if (clear_counter)
zfcp_dbf_rec_adapter(id, ref, adapter->dbf); atomic_set(&adapter->erp_counter, 0);
atomic_clear_mask(mask, &adapter->status);
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) read_lock_irqsave(&adapter->port_list_lock, flags);
atomic_set(&adapter->erp_counter, 0); list_for_each_entry(port, &adapter->port_list, list) {
atomic_clear_mask(common_mask, &port->status);
if (clear_counter)
atomic_set(&port->erp_counter, 0);
} }
read_unlock_irqrestore(&adapter->port_list_lock, flags);
if (common_mask) { shost_for_each_device(sdev, adapter->scsi_host) {
read_lock_irqsave(&adapter->port_list_lock, flags); atomic_clear_mask(common_mask, &sdev_to_zfcp(sdev)->status);
list_for_each_entry(port, &adapter->port_list, list) if (clear_counter)
zfcp_erp_modify_port_status(port, id, ref, common_mask, atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
set_or_clear);
read_unlock_irqrestore(&adapter->port_list_lock, flags);
} }
} }
/** /**
* zfcp_erp_modify_port_status - change port status bits * zfcp_erp_set_port_status - set port status bits
* @port: port to change the status bits * @port: port to change the status
* @id: id for the debug trace
* @ref: reference for the debug trace
* @mask: status bits to change * @mask: status bits to change
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
* *
* Changes in common status bits are propagated to attached LUNs. * Changes in common status bits are propagated to attached LUNs.
*/ */
void zfcp_erp_modify_port_status(struct zfcp_port *port, char *id, void *ref, void zfcp_erp_set_port_status(struct zfcp_port *port, u32 mask)
u32 mask, int set_or_clear)
{ {
struct scsi_device *sdev; struct scsi_device *sdev;
u32 common_mask = mask & ZFCP_COMMON_FLAGS; u32 common_mask = mask & ZFCP_COMMON_FLAGS;
if (set_or_clear == ZFCP_SET) { atomic_set_mask(mask, &port->status);
if (status_change_set(mask, &port->status))
zfcp_dbf_rec_port(id, ref, port);
atomic_set_mask(mask, &port->status);
} else {
if (status_change_clear(mask, &port->status))
zfcp_dbf_rec_port(id, ref, port);
atomic_clear_mask(mask, &port->status);
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED)
atomic_set(&port->erp_counter, 0);
}
if (common_mask) if (!common_mask)
shost_for_each_device(sdev, port->adapter->scsi_host) return;
if (sdev_to_zfcp(sdev)->port == port)
zfcp_erp_modify_lun_status(sdev, id, ref, shost_for_each_device(sdev, port->adapter->scsi_host)
common_mask, if (sdev_to_zfcp(sdev)->port == port)
set_or_clear); atomic_set_mask(common_mask,
&sdev_to_zfcp(sdev)->status);
} }
/** /**
* zfcp_erp_modify_lun_status - change LUN status bits * zfcp_erp_clear_port_status - clear port status bits
* @sdev: SCSI device / LUN where to change the status bits * @port: adapter to change the status
* @id: id for the debug trace
* @ref: reference for the debug trace
* @mask: status bits to change * @mask: status bits to change
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR *
* Changes in common status bits are propagated to attached LUNs.
*/ */
void zfcp_erp_modify_lun_status(struct scsi_device *sdev, char *id, void *ref, void zfcp_erp_clear_port_status(struct zfcp_port *port, u32 mask)
u32 mask, int set_or_clear)
{ {
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev); struct scsi_device *sdev;
u32 common_mask = mask & ZFCP_COMMON_FLAGS;
u32 clear_counter = mask & ZFCP_STATUS_COMMON_ERP_FAILED;
atomic_clear_mask(mask, &port->status);
if (!common_mask)
return;
if (set_or_clear == ZFCP_SET) { if (clear_counter)
if (status_change_set(mask, &zfcp_sdev->status)) atomic_set(&port->erp_counter, 0);
zfcp_dbf_rec_lun(id, ref, sdev);
atomic_set_mask(mask, &zfcp_sdev->status); shost_for_each_device(sdev, port->adapter->scsi_host)
} else { if (sdev_to_zfcp(sdev)->port == port) {
if (status_change_clear(mask, &zfcp_sdev->status)) atomic_clear_mask(common_mask,
zfcp_dbf_rec_lun(id, ref, sdev); &sdev_to_zfcp(sdev)->status);
atomic_clear_mask(mask, &zfcp_sdev->status); if (clear_counter)
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) { atomic_set(&sdev_to_zfcp(sdev)->erp_counter, 0);
atomic_set(&zfcp_sdev->erp_counter, 0);
} }
}
} }
/** /**
* zfcp_erp_port_boxed - Mark port as "boxed" and start ERP * zfcp_erp_set_lun_status - set lun status bits
* @port: The "boxed" port. * @sdev: SCSI device / lun to set the status bits
* @id: The debug trace id. * @mask: status bits to change
* @id: Reference for the debug trace.
*/ */
void zfcp_erp_port_boxed(struct zfcp_port *port, char *id, void *ref) void zfcp_erp_set_lun_status(struct scsi_device *sdev, u32 mask)
{ {
zfcp_erp_modify_port_status(port, id, ref, struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); atomic_set_mask(mask, &zfcp_sdev->status);
} }
/** /**
* zfcp_erp_lun_boxed - Mark LUN as "boxed" and start ERP * zfcp_erp_clear_lun_status - clear lun status bits
* @sdev: The "boxed" SCSI device / LUN. * @sdev: SCSi device / lun to clear the status bits
* @id: The debug trace id. * @mask: status bits to change
* @ref: Reference for the debug trace.
*/ */
void zfcp_erp_lun_boxed(struct scsi_device *sdev, char *id, void *ref) void zfcp_erp_clear_lun_status(struct scsi_device *sdev, u32 mask)
{ {
zfcp_erp_modify_lun_status(sdev, id, ref, struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref); atomic_clear_mask(mask, &zfcp_sdev->status);
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED)
atomic_set(&zfcp_sdev->erp_counter, 0);
} }
...@@ -71,31 +71,26 @@ extern void _zfcp_dbf_scsi(const char *, const char *, int, struct zfcp_dbf *, ...@@ -71,31 +71,26 @@ extern void _zfcp_dbf_scsi(const char *, const char *, int, struct zfcp_dbf *,
unsigned long); unsigned long);
/* zfcp_erp.c */ /* zfcp_erp.c */
extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, char *, extern void zfcp_erp_set_adapter_status(struct zfcp_adapter *, u32);
void *, u32, int); extern void zfcp_erp_clear_adapter_status(struct zfcp_adapter *, u32);
extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *, void *); extern void zfcp_erp_adapter_reopen(struct zfcp_adapter *, int, char *, void *);
extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *, extern void zfcp_erp_adapter_shutdown(struct zfcp_adapter *, int, char *,
void *); void *);
extern void zfcp_erp_adapter_failed(struct zfcp_adapter *, char *, void *); extern void zfcp_erp_set_port_status(struct zfcp_port *, u32);
extern void zfcp_erp_modify_port_status(struct zfcp_port *, char *, void *, u32, extern void zfcp_erp_clear_port_status(struct zfcp_port *, u32);
int);
extern int zfcp_erp_port_reopen(struct zfcp_port *, int, char *, void *); extern int zfcp_erp_port_reopen(struct zfcp_port *, int, char *, void *);
extern void zfcp_erp_port_shutdown(struct zfcp_port *, int, char *, void *); extern void zfcp_erp_port_shutdown(struct zfcp_port *, int, char *, void *);
extern void zfcp_erp_port_forced_reopen(struct zfcp_port *, int, char *, extern void zfcp_erp_port_forced_reopen(struct zfcp_port *, int, char *,
void *); void *);
extern void zfcp_erp_port_failed(struct zfcp_port *, char *, void *); extern void zfcp_erp_set_lun_status(struct scsi_device *, u32);
extern void zfcp_erp_modify_lun_status(struct scsi_device *, char *, void *, extern void zfcp_erp_clear_lun_status(struct scsi_device *, u32);
u32, int);
extern void zfcp_erp_lun_reopen(struct scsi_device *, int, char *, void *); extern void zfcp_erp_lun_reopen(struct scsi_device *, int, char *, void *);
extern void zfcp_erp_lun_shutdown(struct scsi_device *, int, char *, void *); extern void zfcp_erp_lun_shutdown(struct scsi_device *, int, char *, void *);
extern void zfcp_erp_lun_shutdown_wait(struct scsi_device *, char *); extern void zfcp_erp_lun_shutdown_wait(struct scsi_device *, char *);
extern void zfcp_erp_lun_failed(struct scsi_device *, char *, void *);
extern int zfcp_erp_thread_setup(struct zfcp_adapter *); extern int zfcp_erp_thread_setup(struct zfcp_adapter *);
extern void zfcp_erp_thread_kill(struct zfcp_adapter *); extern void zfcp_erp_thread_kill(struct zfcp_adapter *);
extern void zfcp_erp_wait(struct zfcp_adapter *); extern void zfcp_erp_wait(struct zfcp_adapter *);
extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long); extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long);
extern void zfcp_erp_port_boxed(struct zfcp_port *, char *, void *);
extern void zfcp_erp_lun_boxed(struct scsi_device *, char *, void *);
extern void zfcp_erp_timeout_handler(unsigned long); extern void zfcp_erp_timeout_handler(unsigned long);
/* zfcp_fc.c */ /* zfcp_fc.c */
......
...@@ -365,7 +365,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work) ...@@ -365,7 +365,7 @@ void zfcp_fc_port_did_lookup(struct work_struct *work)
} }
if (!port->d_id) { if (!port->d_id) {
zfcp_erp_port_failed(port, "fcgpn_2", NULL); zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED);
goto out; goto out;
} }
......
...@@ -104,7 +104,7 @@ static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req) ...@@ -104,7 +104,7 @@ static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req)
read_unlock_irqrestore(&adapter->port_list_lock, flags); read_unlock_irqrestore(&adapter->port_list_lock, flags);
} }
static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id, static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req,
struct fsf_link_down_info *link_down) struct fsf_link_down_info *link_down)
{ {
struct zfcp_adapter *adapter = req->adapter; struct zfcp_adapter *adapter = req->adapter;
...@@ -184,7 +184,7 @@ static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id, ...@@ -184,7 +184,7 @@ static void zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *req, char *id,
"the FC fabric is down\n"); "the FC fabric is down\n");
} }
out: out:
zfcp_erp_adapter_failed(adapter, id, req); zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_ERP_FAILED);
} }
static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
...@@ -195,13 +195,13 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req) ...@@ -195,13 +195,13 @@ static void zfcp_fsf_status_read_link_down(struct zfcp_fsf_req *req)
switch (sr_buf->status_subtype) { switch (sr_buf->status_subtype) {
case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
zfcp_fsf_link_down_info_eval(req, "fssrld1", ldi); zfcp_fsf_link_down_info_eval(req, ldi);
break; break;
case FSF_STATUS_READ_SUB_FDISC_FAILED: case FSF_STATUS_READ_SUB_FDISC_FAILED:
zfcp_fsf_link_down_info_eval(req, "fssrld2", ldi); zfcp_fsf_link_down_info_eval(req, ldi);
break; break;
case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
zfcp_fsf_link_down_info_eval(req, "fssrld3", NULL); zfcp_fsf_link_down_info_eval(req, NULL);
}; };
} }
...@@ -242,9 +242,8 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) ...@@ -242,9 +242,8 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req)
dev_info(&adapter->ccw_device->dev, dev_info(&adapter->ccw_device->dev,
"The local link has been restored\n"); "The local link has been restored\n");
/* All ports should be marked as ready to run again */ /* All ports should be marked as ready to run again */
zfcp_erp_modify_adapter_status(adapter, "fssrh_1", NULL, zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, zfcp_erp_adapter_reopen(adapter,
ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_STATUS_COMMON_ERP_FAILED,
...@@ -359,16 +358,14 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req) ...@@ -359,16 +358,14 @@ static void zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *req)
zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4", req); zfcp_erp_adapter_shutdown(adapter, 0, "fspse_4", req);
break; break;
case FSF_PROT_LINK_DOWN: case FSF_PROT_LINK_DOWN:
zfcp_fsf_link_down_info_eval(req, "fspse_5", zfcp_fsf_link_down_info_eval(req, &psq->link_down_info);
&psq->link_down_info);
/* go through reopen to flush pending requests */ /* go through reopen to flush pending requests */
zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req); zfcp_erp_adapter_reopen(adapter, 0, "fspse_6", req);
break; break;
case FSF_PROT_REEST_QUEUE: case FSF_PROT_REEST_QUEUE:
/* All ports should be marked as ready to run again */ /* All ports should be marked as ready to run again */
zfcp_erp_modify_adapter_status(adapter, "fspse_7", NULL, zfcp_erp_set_adapter_status(adapter,
ZFCP_STATUS_COMMON_RUNNING, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, zfcp_erp_adapter_reopen(adapter,
ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED | ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_STATUS_COMMON_ERP_FAILED,
...@@ -538,7 +535,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req) ...@@ -538,7 +535,7 @@ static void zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *req)
atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, atomic_set_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
&adapter->status); &adapter->status);
zfcp_fsf_link_down_info_eval(req, "fsecdh2", zfcp_fsf_link_down_info_eval(req,
&qtcb->header.fsf_status_qual.link_down_info); &qtcb->header.fsf_status_qual.link_down_info);
break; break;
default: default:
...@@ -604,7 +601,7 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) ...@@ -604,7 +601,7 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
break; break;
case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE: case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
zfcp_fsf_exchange_port_evaluate(req); zfcp_fsf_exchange_port_evaluate(req);
zfcp_fsf_link_down_info_eval(req, "fsepdh1", zfcp_fsf_link_down_info_eval(req,
&qtcb->header.fsf_status_qual.link_down_info); &qtcb->header.fsf_status_qual.link_down_info);
break; break;
} }
...@@ -797,11 +794,17 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req) ...@@ -797,11 +794,17 @@ static void zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *req)
req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED; req->status |= ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED;
break; break;
case FSF_PORT_BOXED: case FSF_PORT_BOXED:
zfcp_erp_port_boxed(zfcp_sdev->port, "fsafch3", req); zfcp_erp_set_port_status(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_port_reopen(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ERP_FAILED, "fsafch3",
req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_LUN_BOXED: case FSF_LUN_BOXED:
zfcp_erp_lun_boxed(sdev, "fsafch4", req); zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
"fsafch4", req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
...@@ -1343,7 +1346,8 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req) ...@@ -1343,7 +1346,8 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
"Not enough FCP adapter resources to open " "Not enough FCP adapter resources to open "
"remote port 0x%016Lx\n", "remote port 0x%016Lx\n",
(unsigned long long)port->wwpn); (unsigned long long)port->wwpn);
zfcp_erp_port_failed(port, "fsoph_1", req); zfcp_erp_set_port_status(port,
ZFCP_STATUS_COMMON_ERP_FAILED);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
...@@ -1453,9 +1457,7 @@ static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req) ...@@ -1453,9 +1457,7 @@ static void zfcp_fsf_close_port_handler(struct zfcp_fsf_req *req)
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
break; break;
case FSF_GOOD: case FSF_GOOD:
zfcp_erp_modify_port_status(port, "fscph_2", req, zfcp_erp_clear_port_status(port, ZFCP_STATUS_COMMON_OPEN);
ZFCP_STATUS_COMMON_OPEN,
ZFCP_CLEAR);
break; break;
} }
} }
...@@ -1653,7 +1655,9 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req) ...@@ -1653,7 +1655,9 @@ static void zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *req)
if (sdev_to_zfcp(sdev)->port == port) if (sdev_to_zfcp(sdev)->port == port)
atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN,
&sdev_to_zfcp(sdev)->status); &sdev_to_zfcp(sdev)->status);
zfcp_erp_port_boxed(port, "fscpph2", req); zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED,
"fscpph2", req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
...@@ -1751,7 +1755,11 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) ...@@ -1751,7 +1755,11 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_PORT_BOXED: case FSF_PORT_BOXED:
zfcp_erp_port_boxed(zfcp_sdev->port, "fsouh_2", req); zfcp_erp_set_port_status(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_port_reopen(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ERP_FAILED, "fsouh_2",
req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_LUN_SHARING_VIOLATION: case FSF_LUN_SHARING_VIOLATION:
...@@ -1764,7 +1772,7 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req) ...@@ -1764,7 +1772,7 @@ static void zfcp_fsf_open_lun_handler(struct zfcp_fsf_req *req)
"0x%016Lx on port 0x%016Lx\n", "0x%016Lx on port 0x%016Lx\n",
(unsigned long long)zfcp_scsi_dev_lun(sdev), (unsigned long long)zfcp_scsi_dev_lun(sdev),
(unsigned long long)zfcp_sdev->port->wwpn); (unsigned long long)zfcp_sdev->port->wwpn);
zfcp_erp_lun_failed(sdev, "fsolh_4", req); zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ERP_FAILED);
/* fall through */ /* fall through */
case FSF_INVALID_COMMAND_OPTION: case FSF_INVALID_COMMAND_OPTION:
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
...@@ -1856,7 +1864,11 @@ static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req) ...@@ -1856,7 +1864,11 @@ static void zfcp_fsf_close_lun_handler(struct zfcp_fsf_req *req)
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_PORT_BOXED: case FSF_PORT_BOXED:
zfcp_erp_port_boxed(zfcp_sdev->port, "fscuh_3", req); zfcp_erp_set_port_status(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_port_reopen(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ERP_FAILED, "fscuh_3",
req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
...@@ -2032,11 +2044,17 @@ static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req) ...@@ -2032,11 +2044,17 @@ static void zfcp_fsf_fcp_handler_common(struct zfcp_fsf_req *req)
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_PORT_BOXED: case FSF_PORT_BOXED:
zfcp_erp_port_boxed(zfcp_sdev->port, "fssfch5", req); zfcp_erp_set_port_status(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_port_reopen(zfcp_sdev->port,
ZFCP_STATUS_COMMON_ERP_FAILED, "fssfch5",
req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_LUN_BOXED: case FSF_LUN_BOXED:
zfcp_erp_lun_boxed(sdev, "fssfch6", req); zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_ACCESS_BOXED);
zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
"fssfch6", req);
req->status |= ZFCP_STATUS_FSFREQ_ERROR; req->status |= ZFCP_STATUS_FSFREQ_ERROR;
break; break;
case FSF_ADAPTER_STATUS_AVAILABLE: case FSF_ADAPTER_STATUS_AVAILABLE:
......
...@@ -158,8 +158,7 @@ static int zfcp_scsi_slave_alloc(struct scsi_device *sdev) ...@@ -158,8 +158,7 @@ static int zfcp_scsi_slave_alloc(struct scsi_device *sdev)
zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF; zfcp_sdev->latencies.cmd.fabric.min = 0xFFFFFFFF;
spin_lock_init(&zfcp_sdev->latencies.lock); spin_lock_init(&zfcp_sdev->latencies.lock);
zfcp_erp_modify_lun_status(sdev, "scsla_0", NULL, zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_lun_reopen(sdev, 0, "scsla_1", NULL); zfcp_erp_lun_reopen(sdev, 0, "scsla_1", NULL);
zfcp_erp_wait(port->adapter); zfcp_erp_wait(port->adapter);
......
...@@ -104,8 +104,7 @@ static ssize_t zfcp_sysfs_port_failed_store(struct device *dev, ...@@ -104,8 +104,7 @@ static ssize_t zfcp_sysfs_port_failed_store(struct device *dev,
if (strict_strtoul(buf, 0, &val) || val != 0) if (strict_strtoul(buf, 0, &val) || val != 0)
return -EINVAL; return -EINVAL;
zfcp_erp_modify_port_status(port, "sypfai1", NULL, zfcp_erp_set_port_status(port, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "sypfai2", zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, "sypfai2",
NULL); NULL);
zfcp_erp_wait(port->adapter); zfcp_erp_wait(port->adapter);
...@@ -147,9 +146,7 @@ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev, ...@@ -147,9 +146,7 @@ static ssize_t zfcp_sysfs_unit_failed_store(struct device *dev,
sdev = zfcp_unit_sdev(unit); sdev = zfcp_unit_sdev(unit);
if (sdev) { if (sdev) {
zfcp_erp_modify_lun_status(sdev, "syufai1", NULL, zfcp_erp_set_lun_status(sdev, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_STATUS_COMMON_RUNNING,
ZFCP_SET);
zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED,
"syufai2", NULL); "syufai2", NULL);
zfcp_erp_wait(unit->port->adapter); zfcp_erp_wait(unit->port->adapter);
...@@ -199,8 +196,7 @@ static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev, ...@@ -199,8 +196,7 @@ static ssize_t zfcp_sysfs_adapter_failed_store(struct device *dev,
goto out; goto out;
} }
zfcp_erp_modify_adapter_status(adapter, "syafai1", NULL, zfcp_erp_set_adapter_status(adapter, ZFCP_STATUS_COMMON_RUNNING);
ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
"syafai2", NULL); "syafai2", NULL);
zfcp_erp_wait(adapter); zfcp_erp_wait(adapter);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment