|
@@ -30,12 +30,12 @@ enum zfcp_erp_steps {
|
|
ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
|
|
ZFCP_ERP_STEP_PHYS_PORT_CLOSING = 0x0010,
|
|
ZFCP_ERP_STEP_PORT_CLOSING = 0x0100,
|
|
ZFCP_ERP_STEP_PORT_CLOSING = 0x0100,
|
|
ZFCP_ERP_STEP_PORT_OPENING = 0x0800,
|
|
ZFCP_ERP_STEP_PORT_OPENING = 0x0800,
|
|
- ZFCP_ERP_STEP_UNIT_CLOSING = 0x1000,
|
|
|
|
- ZFCP_ERP_STEP_UNIT_OPENING = 0x2000,
|
|
|
|
|
|
+ ZFCP_ERP_STEP_LUN_CLOSING = 0x1000,
|
|
|
|
+ ZFCP_ERP_STEP_LUN_OPENING = 0x2000,
|
|
};
|
|
};
|
|
|
|
|
|
enum zfcp_erp_act_type {
|
|
enum zfcp_erp_act_type {
|
|
- ZFCP_ERP_ACTION_REOPEN_UNIT = 1,
|
|
|
|
|
|
+ ZFCP_ERP_ACTION_REOPEN_LUN = 1,
|
|
ZFCP_ERP_ACTION_REOPEN_PORT = 2,
|
|
ZFCP_ERP_ACTION_REOPEN_PORT = 2,
|
|
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
|
|
ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
|
|
ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
|
|
ZFCP_ERP_ACTION_REOPEN_ADAPTER = 4,
|
|
@@ -89,24 +89,24 @@ static void zfcp_erp_action_dismiss(struct zfcp_erp_action *act)
|
|
zfcp_erp_action_ready(act);
|
|
zfcp_erp_action_ready(act);
|
|
}
|
|
}
|
|
|
|
|
|
-static void zfcp_erp_action_dismiss_unit(struct zfcp_unit *unit)
|
|
|
|
|
|
+static void zfcp_erp_action_dismiss_lun(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
|
|
- zfcp_erp_action_dismiss(&unit->erp_action);
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
|
|
+ zfcp_erp_action_dismiss(&zfcp_sdev->erp_action);
|
|
}
|
|
}
|
|
|
|
|
|
static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)
|
|
static void zfcp_erp_action_dismiss_port(struct zfcp_port *port)
|
|
{
|
|
{
|
|
- struct zfcp_unit *unit;
|
|
|
|
|
|
+ struct scsi_device *sdev;
|
|
|
|
|
|
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
if (atomic_read(&port->status) & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
zfcp_erp_action_dismiss(&port->erp_action);
|
|
zfcp_erp_action_dismiss(&port->erp_action);
|
|
- else {
|
|
|
|
- read_lock(&port->unit_list_lock);
|
|
|
|
- list_for_each_entry(unit, &port->unit_list, list)
|
|
|
|
- zfcp_erp_action_dismiss_unit(unit);
|
|
|
|
- read_unlock(&port->unit_list_lock);
|
|
|
|
- }
|
|
|
|
|
|
+ else
|
|
|
|
+ shost_for_each_device(sdev, port->adapter->scsi_host)
|
|
|
|
+ if (sdev_to_zfcp(sdev)->port == port)
|
|
|
|
+ zfcp_erp_action_dismiss_lun(sdev);
|
|
}
|
|
}
|
|
|
|
|
|
static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
|
|
static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
|
|
@@ -125,15 +125,17 @@ static void zfcp_erp_action_dismiss_adapter(struct zfcp_adapter *adapter)
|
|
|
|
|
|
static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
|
|
static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
|
|
struct zfcp_port *port,
|
|
struct zfcp_port *port,
|
|
- struct zfcp_unit *unit)
|
|
|
|
|
|
+ struct scsi_device *sdev)
|
|
{
|
|
{
|
|
int need = want;
|
|
int need = want;
|
|
- int u_status, p_status, a_status;
|
|
|
|
|
|
+ int l_status, p_status, a_status;
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev;
|
|
|
|
|
|
switch (want) {
|
|
switch (want) {
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
- u_status = atomic_read(&unit->status);
|
|
|
|
- if (u_status & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ l_status = atomic_read(&zfcp_sdev->status);
|
|
|
|
+ if (l_status & ZFCP_STATUS_COMMON_ERP_INUSE)
|
|
return 0;
|
|
return 0;
|
|
p_status = atomic_read(&port->status);
|
|
p_status = atomic_read(&port->status);
|
|
if (!(p_status & ZFCP_STATUS_COMMON_RUNNING) ||
|
|
if (!(p_status & ZFCP_STATUS_COMMON_RUNNING) ||
|
|
@@ -173,18 +175,22 @@ static int zfcp_erp_required_act(int want, struct zfcp_adapter *adapter,
|
|
static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|
static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|
struct zfcp_adapter *adapter,
|
|
struct zfcp_adapter *adapter,
|
|
struct zfcp_port *port,
|
|
struct zfcp_port *port,
|
|
- struct zfcp_unit *unit)
|
|
|
|
|
|
+ struct scsi_device *sdev)
|
|
{
|
|
{
|
|
struct zfcp_erp_action *erp_action;
|
|
struct zfcp_erp_action *erp_action;
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev;
|
|
|
|
|
|
switch (need) {
|
|
switch (need) {
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ zfcp_sdev = sdev_to_zfcp(sdev);
|
|
if (!(act_status & ZFCP_STATUS_ERP_NO_REF))
|
|
if (!(act_status & ZFCP_STATUS_ERP_NO_REF))
|
|
- if (!get_device(&unit->dev))
|
|
|
|
|
|
+ if (scsi_device_get(sdev))
|
|
return NULL;
|
|
return NULL;
|
|
- atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &unit->status);
|
|
|
|
- erp_action = &unit->erp_action;
|
|
|
|
- if (!(atomic_read(&unit->status) & ZFCP_STATUS_COMMON_RUNNING))
|
|
|
|
|
|
+ atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
|
|
|
|
+ &zfcp_sdev->status);
|
|
|
|
+ erp_action = &zfcp_sdev->erp_action;
|
|
|
|
+ if (!(atomic_read(&zfcp_sdev->status) &
|
|
|
|
+ ZFCP_STATUS_COMMON_RUNNING))
|
|
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
|
|
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -216,7 +222,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
|
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
|
erp_action->adapter = adapter;
|
|
erp_action->adapter = adapter;
|
|
erp_action->port = port;
|
|
erp_action->port = port;
|
|
- erp_action->unit = unit;
|
|
|
|
|
|
+ erp_action->sdev = sdev;
|
|
erp_action->action = need;
|
|
erp_action->action = need;
|
|
erp_action->status = act_status;
|
|
erp_action->status = act_status;
|
|
|
|
|
|
@@ -225,8 +231,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|
|
|
|
|
static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
|
static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
|
struct zfcp_port *port,
|
|
struct zfcp_port *port,
|
|
- struct zfcp_unit *unit, char *id, void *ref,
|
|
|
|
- u32 act_status)
|
|
|
|
|
|
+ struct scsi_device *sdev,
|
|
|
|
+ char *id, void *ref, u32 act_status)
|
|
{
|
|
{
|
|
int retval = 1, need;
|
|
int retval = 1, need;
|
|
struct zfcp_erp_action *act = NULL;
|
|
struct zfcp_erp_action *act = NULL;
|
|
@@ -234,11 +240,11 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
|
if (!adapter->erp_thread)
|
|
if (!adapter->erp_thread)
|
|
return -EIO;
|
|
return -EIO;
|
|
|
|
|
|
- need = zfcp_erp_required_act(want, adapter, port, unit);
|
|
|
|
|
|
+ need = zfcp_erp_required_act(want, adapter, port, sdev);
|
|
if (!need)
|
|
if (!need)
|
|
goto out;
|
|
goto out;
|
|
|
|
|
|
- act = zfcp_erp_setup_act(need, act_status, adapter, port, unit);
|
|
|
|
|
|
+ act = zfcp_erp_setup_act(need, act_status, adapter, port, sdev);
|
|
if (!act)
|
|
if (!act)
|
|
goto out;
|
|
goto out;
|
|
atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
|
|
atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
|
|
@@ -248,7 +254,7 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
|
|
zfcp_dbf_rec_thread("eracte1", adapter->dbf);
|
|
zfcp_dbf_rec_thread("eracte1", adapter->dbf);
|
|
retval = 0;
|
|
retval = 0;
|
|
out:
|
|
out:
|
|
- zfcp_dbf_rec_trigger(id, ref, want, need, act, adapter, port, unit);
|
|
|
|
|
|
+ zfcp_dbf_rec_trigger(id, ref, want, need, act, adapter, port, sdev);
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -392,77 +398,81 @@ int zfcp_erp_port_reopen(struct zfcp_port *port, int clear, char *id, void *ref)
|
|
return retval;
|
|
return retval;
|
|
}
|
|
}
|
|
|
|
|
|
-static void zfcp_erp_unit_block(struct zfcp_unit *unit, int clear_mask)
|
|
|
|
|
|
+static void zfcp_erp_lun_block(struct scsi_device *sdev, int clear_mask)
|
|
{
|
|
{
|
|
- zfcp_erp_modify_unit_status(unit, "erublk1", NULL,
|
|
|
|
- ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask,
|
|
|
|
- ZFCP_CLEAR);
|
|
|
|
|
|
+ zfcp_erp_modify_lun_status(sdev, "erlblk1", NULL,
|
|
|
|
+ ZFCP_STATUS_COMMON_UNBLOCKED | clear_mask,
|
|
|
|
+ ZFCP_CLEAR);
|
|
}
|
|
}
|
|
|
|
|
|
-static void _zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear, char *id,
|
|
|
|
- void *ref, u32 act_status)
|
|
|
|
|
|
+static void _zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
|
|
|
|
+ void *ref, u32 act_status)
|
|
{
|
|
{
|
|
- struct zfcp_adapter *adapter = unit->port->adapter;
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
|
|
|
|
|
|
- zfcp_erp_unit_block(unit, clear);
|
|
|
|
|
|
+ zfcp_erp_lun_block(sdev, clear);
|
|
|
|
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
|
|
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED)
|
|
return;
|
|
return;
|
|
|
|
|
|
- zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_UNIT,
|
|
|
|
- adapter, unit->port, unit, id, ref, act_status);
|
|
|
|
|
|
+ zfcp_erp_action_enqueue(ZFCP_ERP_ACTION_REOPEN_LUN, adapter,
|
|
|
|
+ zfcp_sdev->port, sdev, id, ref, act_status);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_reopen - initiate reopen of a unit
|
|
|
|
- * @unit: unit to be reopened
|
|
|
|
- * @clear_mask: specifies flags in unit status to be cleared
|
|
|
|
|
|
+ * zfcp_erp_lun_reopen - initiate reopen of a LUN
|
|
|
|
+ * @sdev: SCSI device / LUN to be reopened
|
|
|
|
+ * @clear_mask: specifies flags in LUN status to be cleared
|
|
* Return: 0 on success, < 0 on error
|
|
* Return: 0 on success, < 0 on error
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_reopen(struct zfcp_unit *unit, int clear, char *id,
|
|
|
|
- void *ref)
|
|
|
|
|
|
+void zfcp_erp_lun_reopen(struct scsi_device *sdev, int clear, char *id,
|
|
|
|
+ void *ref)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
- struct zfcp_port *port = unit->port;
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ struct zfcp_port *port = zfcp_sdev->port;
|
|
struct zfcp_adapter *adapter = port->adapter;
|
|
struct zfcp_adapter *adapter = port->adapter;
|
|
|
|
|
|
write_lock_irqsave(&adapter->erp_lock, flags);
|
|
write_lock_irqsave(&adapter->erp_lock, flags);
|
|
- _zfcp_erp_unit_reopen(unit, clear, id, ref, 0);
|
|
|
|
|
|
+ _zfcp_erp_lun_reopen(sdev, clear, id, ref, 0);
|
|
write_unlock_irqrestore(&adapter->erp_lock, flags);
|
|
write_unlock_irqrestore(&adapter->erp_lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_shutdown - Shutdown unit
|
|
|
|
- * @unit: Unit to shut down.
|
|
|
|
|
|
+ * zfcp_erp_lun_shutdown - Shutdown LUN
|
|
|
|
+ * @sdev: SCSI device / LUN to shut down.
|
|
* @clear: Status flags to clear.
|
|
* @clear: Status flags to clear.
|
|
* @id: Id for debug trace event.
|
|
* @id: Id for debug trace event.
|
|
* @ref: Reference for debug trace event.
|
|
* @ref: Reference for debug trace event.
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_shutdown(struct zfcp_unit *unit, int clear, char *id,
|
|
|
|
- void *ref)
|
|
|
|
|
|
+void zfcp_erp_lun_shutdown(struct scsi_device *sdev, int clear, char *id,
|
|
|
|
+ void *ref)
|
|
{
|
|
{
|
|
int flags = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
|
|
int flags = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
|
|
- zfcp_erp_unit_reopen(unit, clear | flags, id, ref);
|
|
|
|
|
|
+ zfcp_erp_lun_reopen(sdev, clear | flags, id, ref);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_shutdown_wait - Shutdown unit and wait for erp completion
|
|
|
|
- * @unit: Unit to shut down.
|
|
|
|
|
|
+ * zfcp_erp_lun_shutdown_wait - Shutdown LUN and wait for erp completion
|
|
|
|
+ * @sdev: SCSI device / LUN to shut down.
|
|
* @id: Id for debug trace event.
|
|
* @id: Id for debug trace event.
|
|
*
|
|
*
|
|
- * Do not acquire a reference for the unit when creating the ERP
|
|
|
|
|
|
+ * Do not acquire a reference for the LUN when creating the ERP
|
|
* action. It is safe, because this function waits for the ERP to
|
|
* action. It is safe, because this function waits for the ERP to
|
|
- * complete first.
|
|
|
|
|
|
+ * complete first. This allows to shutdown the LUN, even when the SCSI
|
|
|
|
+ * device is in the state SDEV_DEL when scsi_device_get will fail.
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_shutdown_wait(struct zfcp_unit *unit, char *id)
|
|
|
|
|
|
+void zfcp_erp_lun_shutdown_wait(struct scsi_device *sdev, char *id)
|
|
{
|
|
{
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
- struct zfcp_port *port = unit->port;
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ struct zfcp_port *port = zfcp_sdev->port;
|
|
struct zfcp_adapter *adapter = port->adapter;
|
|
struct zfcp_adapter *adapter = port->adapter;
|
|
int clear = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
|
|
int clear = ZFCP_STATUS_COMMON_RUNNING | ZFCP_STATUS_COMMON_ERP_FAILED;
|
|
|
|
|
|
write_lock_irqsave(&adapter->erp_lock, flags);
|
|
write_lock_irqsave(&adapter->erp_lock, flags);
|
|
- _zfcp_erp_unit_reopen(unit, clear, id, NULL, ZFCP_STATUS_ERP_NO_REF);
|
|
|
|
|
|
+ _zfcp_erp_lun_reopen(sdev, clear, id, NULL, ZFCP_STATUS_ERP_NO_REF);
|
|
write_unlock_irqrestore(&adapter->erp_lock, flags);
|
|
write_unlock_irqrestore(&adapter->erp_lock, flags);
|
|
|
|
|
|
zfcp_erp_wait(adapter);
|
|
zfcp_erp_wait(adapter);
|
|
@@ -492,11 +502,13 @@ static void zfcp_erp_port_unblock(struct zfcp_port *port)
|
|
atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status);
|
|
atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &port->status);
|
|
}
|
|
}
|
|
|
|
|
|
-static void zfcp_erp_unit_unblock(struct zfcp_unit *unit)
|
|
|
|
|
|
+static void zfcp_erp_lun_unblock(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
- if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status))
|
|
|
|
- zfcp_dbf_rec_unit("eruubl1", NULL, unit);
|
|
|
|
- atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &unit->status);
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+
|
|
|
|
+ if (status_change_set(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status))
|
|
|
|
+ zfcp_dbf_rec_lun("erlubl1", NULL, sdev);
|
|
|
|
+ atomic_set_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &zfcp_sdev->status);
|
|
}
|
|
}
|
|
|
|
|
|
static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
|
|
static void zfcp_erp_action_to_running(struct zfcp_erp_action *erp_action)
|
|
@@ -584,15 +596,14 @@ static void _zfcp_erp_port_reopen_all(struct zfcp_adapter *adapter,
|
|
read_unlock(&adapter->port_list_lock);
|
|
read_unlock(&adapter->port_list_lock);
|
|
}
|
|
}
|
|
|
|
|
|
-static void _zfcp_erp_unit_reopen_all(struct zfcp_port *port, int clear,
|
|
|
|
- char *id, void *ref)
|
|
|
|
|
|
+static void _zfcp_erp_lun_reopen_all(struct zfcp_port *port, int clear,
|
|
|
|
+ char *id, void *ref)
|
|
{
|
|
{
|
|
- struct zfcp_unit *unit;
|
|
|
|
|
|
+ struct scsi_device *sdev;
|
|
|
|
|
|
- read_lock(&port->unit_list_lock);
|
|
|
|
- list_for_each_entry(unit, &port->unit_list, list)
|
|
|
|
- _zfcp_erp_unit_reopen(unit, clear, id, ref, 0);
|
|
|
|
- read_unlock(&port->unit_list_lock);
|
|
|
|
|
|
+ shost_for_each_device(sdev, port->adapter->scsi_host)
|
|
|
|
+ if (sdev_to_zfcp(sdev)->port == port)
|
|
|
|
+ _zfcp_erp_lun_reopen(sdev, clear, id, ref, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
|
|
static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
|
|
@@ -607,8 +618,8 @@ static void zfcp_erp_strategy_followup_failed(struct zfcp_erp_action *act)
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
_zfcp_erp_port_reopen(act->port, 0, "ersff_3", NULL);
|
|
_zfcp_erp_port_reopen(act->port, 0, "ersff_3", NULL);
|
|
break;
|
|
break;
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
- _zfcp_erp_unit_reopen(act->unit, 0, "ersff_4", NULL, 0);
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ _zfcp_erp_lun_reopen(act->sdev, 0, "ersff_4", NULL, 0);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -623,7 +634,7 @@ static void zfcp_erp_strategy_followup_success(struct zfcp_erp_action *act)
|
|
_zfcp_erp_port_reopen(act->port, 0, "ersfs_2", NULL);
|
|
_zfcp_erp_port_reopen(act->port, 0, "ersfs_2", NULL);
|
|
break;
|
|
break;
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
- _zfcp_erp_unit_reopen_all(act->port, 0, "ersfs_3", NULL);
|
|
|
|
|
|
+ _zfcp_erp_lun_reopen_all(act->port, 0, "ersfs_3", NULL);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -767,7 +778,7 @@ static void zfcp_erp_adapter_strategy_close(struct zfcp_erp_action *act)
|
|
zfcp_fsf_req_dismiss_all(adapter);
|
|
zfcp_fsf_req_dismiss_all(adapter);
|
|
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 units are closed */
|
|
|
|
|
|
+ /* all ports and LUNs are closed */
|
|
zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL,
|
|
zfcp_erp_modify_adapter_status(adapter, "erascl1", NULL,
|
|
ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
|
|
ZFCP_STATUS_COMMON_OPEN, ZFCP_CLEAR);
|
|
|
|
|
|
@@ -958,82 +969,86 @@ close_init_done:
|
|
return zfcp_erp_port_strategy_open_common(erp_action);
|
|
return zfcp_erp_port_strategy_open_common(erp_action);
|
|
}
|
|
}
|
|
|
|
|
|
-static void zfcp_erp_unit_strategy_clearstati(struct zfcp_unit *unit)
|
|
|
|
|
|
+static void zfcp_erp_lun_strategy_clearstati(struct scsi_device *sdev)
|
|
{
|
|
{
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+
|
|
atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
atomic_clear_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
- ZFCP_STATUS_UNIT_SHARED |
|
|
|
|
- ZFCP_STATUS_UNIT_READONLY,
|
|
|
|
- &unit->status);
|
|
|
|
|
|
+ ZFCP_STATUS_LUN_SHARED | ZFCP_STATUS_LUN_READONLY,
|
|
|
|
+ &zfcp_sdev->status);
|
|
}
|
|
}
|
|
|
|
|
|
-static int zfcp_erp_unit_strategy_close(struct zfcp_erp_action *erp_action)
|
|
|
|
|
|
+static int zfcp_erp_lun_strategy_close(struct zfcp_erp_action *erp_action)
|
|
{
|
|
{
|
|
- int retval = zfcp_fsf_close_unit(erp_action);
|
|
|
|
|
|
+ int retval = zfcp_fsf_close_lun(erp_action);
|
|
if (retval == -ENOMEM)
|
|
if (retval == -ENOMEM)
|
|
return ZFCP_ERP_NOMEM;
|
|
return ZFCP_ERP_NOMEM;
|
|
- erp_action->step = ZFCP_ERP_STEP_UNIT_CLOSING;
|
|
|
|
|
|
+ erp_action->step = ZFCP_ERP_STEP_LUN_CLOSING;
|
|
if (retval)
|
|
if (retval)
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_CONTINUES;
|
|
return ZFCP_ERP_CONTINUES;
|
|
}
|
|
}
|
|
|
|
|
|
-static int zfcp_erp_unit_strategy_open(struct zfcp_erp_action *erp_action)
|
|
|
|
|
|
+static int zfcp_erp_lun_strategy_open(struct zfcp_erp_action *erp_action)
|
|
{
|
|
{
|
|
- int retval = zfcp_fsf_open_unit(erp_action);
|
|
|
|
|
|
+ int retval = zfcp_fsf_open_lun(erp_action);
|
|
if (retval == -ENOMEM)
|
|
if (retval == -ENOMEM)
|
|
return ZFCP_ERP_NOMEM;
|
|
return ZFCP_ERP_NOMEM;
|
|
- erp_action->step = ZFCP_ERP_STEP_UNIT_OPENING;
|
|
|
|
|
|
+ erp_action->step = ZFCP_ERP_STEP_LUN_OPENING;
|
|
if (retval)
|
|
if (retval)
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_CONTINUES;
|
|
return ZFCP_ERP_CONTINUES;
|
|
}
|
|
}
|
|
|
|
|
|
-static int zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action)
|
|
|
|
|
|
+static int zfcp_erp_lun_strategy(struct zfcp_erp_action *erp_action)
|
|
{
|
|
{
|
|
- struct zfcp_unit *unit = erp_action->unit;
|
|
|
|
|
|
+ struct scsi_device *sdev = erp_action->sdev;
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
|
|
switch (erp_action->step) {
|
|
switch (erp_action->step) {
|
|
case ZFCP_ERP_STEP_UNINITIALIZED:
|
|
case ZFCP_ERP_STEP_UNINITIALIZED:
|
|
- zfcp_erp_unit_strategy_clearstati(unit);
|
|
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
|
|
- return zfcp_erp_unit_strategy_close(erp_action);
|
|
|
|
|
|
+ zfcp_erp_lun_strategy_clearstati(sdev);
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
|
|
+ return zfcp_erp_lun_strategy_close(erp_action);
|
|
/* already closed, fall through */
|
|
/* already closed, fall through */
|
|
- case ZFCP_ERP_STEP_UNIT_CLOSING:
|
|
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
|
|
|
|
+ case ZFCP_ERP_STEP_LUN_CLOSING:
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_FAILED;
|
|
if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
|
|
if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
|
|
return ZFCP_ERP_EXIT;
|
|
return ZFCP_ERP_EXIT;
|
|
- return zfcp_erp_unit_strategy_open(erp_action);
|
|
|
|
|
|
+ return zfcp_erp_lun_strategy_open(erp_action);
|
|
|
|
|
|
- case ZFCP_ERP_STEP_UNIT_OPENING:
|
|
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
|
|
|
|
+ case ZFCP_ERP_STEP_LUN_OPENING:
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_OPEN)
|
|
return ZFCP_ERP_SUCCEEDED;
|
|
return ZFCP_ERP_SUCCEEDED;
|
|
}
|
|
}
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_FAILED;
|
|
}
|
|
}
|
|
|
|
|
|
-static int zfcp_erp_strategy_check_unit(struct zfcp_unit *unit, int result)
|
|
|
|
|
|
+static int zfcp_erp_strategy_check_lun(struct scsi_device *sdev, int result)
|
|
{
|
|
{
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+
|
|
switch (result) {
|
|
switch (result) {
|
|
case ZFCP_ERP_SUCCEEDED :
|
|
case ZFCP_ERP_SUCCEEDED :
|
|
- atomic_set(&unit->erp_counter, 0);
|
|
|
|
- zfcp_erp_unit_unblock(unit);
|
|
|
|
|
|
+ atomic_set(&zfcp_sdev->erp_counter, 0);
|
|
|
|
+ zfcp_erp_lun_unblock(sdev);
|
|
break;
|
|
break;
|
|
case ZFCP_ERP_FAILED :
|
|
case ZFCP_ERP_FAILED :
|
|
- atomic_inc(&unit->erp_counter);
|
|
|
|
- if (atomic_read(&unit->erp_counter) > ZFCP_MAX_ERPS) {
|
|
|
|
- dev_err(&unit->port->adapter->ccw_device->dev,
|
|
|
|
- "ERP failed for unit 0x%016Lx on "
|
|
|
|
|
|
+ atomic_inc(&zfcp_sdev->erp_counter);
|
|
|
|
+ if (atomic_read(&zfcp_sdev->erp_counter) > ZFCP_MAX_ERPS) {
|
|
|
|
+ dev_err(&zfcp_sdev->port->adapter->ccw_device->dev,
|
|
|
|
+ "ERP failed for LUN 0x%016Lx on "
|
|
"port 0x%016Lx\n",
|
|
"port 0x%016Lx\n",
|
|
- (unsigned long long)unit->fcp_lun,
|
|
|
|
- (unsigned long long)unit->port->wwpn);
|
|
|
|
- zfcp_erp_unit_failed(unit, "erusck1", NULL);
|
|
|
|
|
|
+ (unsigned long long)zfcp_scsi_dev_lun(sdev),
|
|
|
|
+ (unsigned long long)zfcp_sdev->port->wwpn);
|
|
|
|
+ zfcp_erp_lun_failed(sdev, "ersckl1", NULL);
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- if (atomic_read(&unit->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
|
|
|
|
- zfcp_erp_unit_block(unit, 0);
|
|
|
|
|
|
+ if (atomic_read(&zfcp_sdev->status) & ZFCP_STATUS_COMMON_ERP_FAILED) {
|
|
|
|
+ zfcp_erp_lun_block(sdev, 0);
|
|
result = ZFCP_ERP_EXIT;
|
|
result = ZFCP_ERP_EXIT;
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
@@ -1101,12 +1116,12 @@ static int zfcp_erp_strategy_check_target(struct zfcp_erp_action *erp_action,
|
|
{
|
|
{
|
|
struct zfcp_adapter *adapter = erp_action->adapter;
|
|
struct zfcp_adapter *adapter = erp_action->adapter;
|
|
struct zfcp_port *port = erp_action->port;
|
|
struct zfcp_port *port = erp_action->port;
|
|
- struct zfcp_unit *unit = erp_action->unit;
|
|
|
|
|
|
+ struct scsi_device *sdev = erp_action->sdev;
|
|
|
|
|
|
switch (erp_action->action) {
|
|
switch (erp_action->action) {
|
|
|
|
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
- result = zfcp_erp_strategy_check_unit(unit, result);
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ result = zfcp_erp_strategy_check_lun(sdev, result);
|
|
break;
|
|
break;
|
|
|
|
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
|
|
@@ -1141,7 +1156,8 @@ static int zfcp_erp_strategy_statechange(struct zfcp_erp_action *act, int ret)
|
|
int action = act->action;
|
|
int action = act->action;
|
|
struct zfcp_adapter *adapter = act->adapter;
|
|
struct zfcp_adapter *adapter = act->adapter;
|
|
struct zfcp_port *port = act->port;
|
|
struct zfcp_port *port = act->port;
|
|
- struct zfcp_unit *unit = act->unit;
|
|
|
|
|
|
+ struct scsi_device *sdev = act->sdev;
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev;
|
|
u32 erp_status = act->status;
|
|
u32 erp_status = act->status;
|
|
|
|
|
|
switch (action) {
|
|
switch (action) {
|
|
@@ -1164,11 +1180,12 @@ static int zfcp_erp_strategy_statechange(struct zfcp_erp_action *act, int ret)
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
|
|
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
- if (zfcp_erp_strat_change_det(&unit->status, erp_status)) {
|
|
|
|
- _zfcp_erp_unit_reopen(unit,
|
|
|
|
- ZFCP_STATUS_COMMON_ERP_FAILED,
|
|
|
|
- "ersscg3", NULL, 0);
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ if (zfcp_erp_strat_change_det(&zfcp_sdev->status, erp_status)) {
|
|
|
|
+ _zfcp_erp_lun_reopen(sdev,
|
|
|
|
+ ZFCP_STATUS_COMMON_ERP_FAILED,
|
|
|
|
+ "ersscg3", NULL, 0);
|
|
return ZFCP_ERP_EXIT;
|
|
return ZFCP_ERP_EXIT;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1179,6 +1196,7 @@ static int zfcp_erp_strategy_statechange(struct zfcp_erp_action *act, int ret)
|
|
static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
|
|
static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
|
|
{
|
|
{
|
|
struct zfcp_adapter *adapter = erp_action->adapter;
|
|
struct zfcp_adapter *adapter = erp_action->adapter;
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev;
|
|
|
|
|
|
adapter->erp_total_count--;
|
|
adapter->erp_total_count--;
|
|
if (erp_action->status & ZFCP_STATUS_ERP_LOWMEM) {
|
|
if (erp_action->status & ZFCP_STATUS_ERP_LOWMEM) {
|
|
@@ -1190,9 +1208,10 @@ static void zfcp_erp_action_dequeue(struct zfcp_erp_action *erp_action)
|
|
zfcp_dbf_rec_action("eractd1", erp_action);
|
|
zfcp_dbf_rec_action("eractd1", erp_action);
|
|
|
|
|
|
switch (erp_action->action) {
|
|
switch (erp_action->action) {
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ zfcp_sdev = sdev_to_zfcp(erp_action->sdev);
|
|
atomic_clear_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
|
|
atomic_clear_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
|
|
- &erp_action->unit->status);
|
|
|
|
|
|
+ &zfcp_sdev->status);
|
|
break;
|
|
break;
|
|
|
|
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
|
|
@@ -1212,12 +1231,12 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result)
|
|
{
|
|
{
|
|
struct zfcp_adapter *adapter = act->adapter;
|
|
struct zfcp_adapter *adapter = act->adapter;
|
|
struct zfcp_port *port = act->port;
|
|
struct zfcp_port *port = act->port;
|
|
- struct zfcp_unit *unit = act->unit;
|
|
|
|
|
|
+ struct scsi_device *sdev = act->sdev;
|
|
|
|
|
|
switch (act->action) {
|
|
switch (act->action) {
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
if (!(act->status & ZFCP_STATUS_ERP_NO_REF))
|
|
if (!(act->status & ZFCP_STATUS_ERP_NO_REF))
|
|
- put_device(&unit->dev);
|
|
|
|
|
|
+ scsi_device_put(sdev);
|
|
break;
|
|
break;
|
|
|
|
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
@@ -1248,8 +1267,8 @@ static int zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action)
|
|
return zfcp_erp_port_forced_strategy(erp_action);
|
|
return zfcp_erp_port_forced_strategy(erp_action);
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
case ZFCP_ERP_ACTION_REOPEN_PORT:
|
|
return zfcp_erp_port_strategy(erp_action);
|
|
return zfcp_erp_port_strategy(erp_action);
|
|
- case ZFCP_ERP_ACTION_REOPEN_UNIT:
|
|
|
|
- return zfcp_erp_unit_strategy(erp_action);
|
|
|
|
|
|
+ case ZFCP_ERP_ACTION_REOPEN_LUN:
|
|
|
|
+ return zfcp_erp_lun_strategy(erp_action);
|
|
}
|
|
}
|
|
return ZFCP_ERP_FAILED;
|
|
return ZFCP_ERP_FAILED;
|
|
}
|
|
}
|
|
@@ -1426,15 +1445,15 @@ void zfcp_erp_port_failed(struct zfcp_port *port, char *id, void *ref)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_failed - Set unit status to failed.
|
|
|
|
- * @unit: Failed unit.
|
|
|
|
|
|
+ * zfcp_erp_lun_failed - Set LUN status to failed.
|
|
|
|
+ * @sdev: Failed SCSI device / LUN
|
|
* @id: Event id for debug trace.
|
|
* @id: Event id for debug trace.
|
|
* @ref: Reference for debug trace.
|
|
* @ref: Reference for debug trace.
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_failed(struct zfcp_unit *unit, char *id, void *ref)
|
|
|
|
|
|
+void zfcp_erp_lun_failed(struct scsi_device *sdev, char *id, void *ref)
|
|
{
|
|
{
|
|
- zfcp_erp_modify_unit_status(unit, id, ref,
|
|
|
|
- ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
|
|
|
|
|
|
+ zfcp_erp_modify_lun_status(sdev, id, ref,
|
|
|
|
+ ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1456,7 +1475,7 @@ void zfcp_erp_wait(struct zfcp_adapter *adapter)
|
|
* @mask: status bits to change
|
|
* @mask: status bits to change
|
|
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
|
|
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
|
|
*
|
|
*
|
|
- * Changes in common status bits are propagated to attached ports and units.
|
|
|
|
|
|
+ * 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_modify_adapter_status(struct zfcp_adapter *adapter, char *id,
|
|
void *ref, u32 mask, int set_or_clear)
|
|
void *ref, u32 mask, int set_or_clear)
|
|
@@ -1494,13 +1513,12 @@ void zfcp_erp_modify_adapter_status(struct zfcp_adapter *adapter, char *id,
|
|
* @mask: status bits to change
|
|
* @mask: status bits to change
|
|
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
|
|
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
|
|
*
|
|
*
|
|
- * Changes in common status bits are propagated to attached units.
|
|
|
|
|
|
+ * 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_modify_port_status(struct zfcp_port *port, char *id, void *ref,
|
|
u32 mask, int set_or_clear)
|
|
u32 mask, int set_or_clear)
|
|
{
|
|
{
|
|
- struct zfcp_unit *unit;
|
|
|
|
- unsigned long flags;
|
|
|
|
|
|
+ struct scsi_device *sdev;
|
|
u32 common_mask = mask & ZFCP_COMMON_FLAGS;
|
|
u32 common_mask = mask & ZFCP_COMMON_FLAGS;
|
|
|
|
|
|
if (set_or_clear == ZFCP_SET) {
|
|
if (set_or_clear == ZFCP_SET) {
|
|
@@ -1515,36 +1533,37 @@ void zfcp_erp_modify_port_status(struct zfcp_port *port, char *id, void *ref,
|
|
atomic_set(&port->erp_counter, 0);
|
|
atomic_set(&port->erp_counter, 0);
|
|
}
|
|
}
|
|
|
|
|
|
- if (common_mask) {
|
|
|
|
- read_lock_irqsave(&port->unit_list_lock, flags);
|
|
|
|
- list_for_each_entry(unit, &port->unit_list, list)
|
|
|
|
- zfcp_erp_modify_unit_status(unit, id, ref, common_mask,
|
|
|
|
- set_or_clear);
|
|
|
|
- read_unlock_irqrestore(&port->unit_list_lock, flags);
|
|
|
|
- }
|
|
|
|
|
|
+ if (common_mask)
|
|
|
|
+ shost_for_each_device(sdev, port->adapter->scsi_host)
|
|
|
|
+ if (sdev_to_zfcp(sdev)->port == port)
|
|
|
|
+ zfcp_erp_modify_lun_status(sdev, id, ref,
|
|
|
|
+ common_mask,
|
|
|
|
+ set_or_clear);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_modify_unit_status - change unit status bits
|
|
|
|
- * @unit: unit to change the status bits
|
|
|
|
|
|
+ * zfcp_erp_modify_lun_status - change LUN status bits
|
|
|
|
+ * @sdev: SCSI device / LUN where to change the status bits
|
|
* @id: id for the debug trace
|
|
* @id: id for the debug trace
|
|
* @ref: reference 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
|
|
* @set_or_clear: ZFCP_SET or ZFCP_CLEAR
|
|
*/
|
|
*/
|
|
-void zfcp_erp_modify_unit_status(struct zfcp_unit *unit, char *id, void *ref,
|
|
|
|
- u32 mask, int set_or_clear)
|
|
|
|
|
|
+void zfcp_erp_modify_lun_status(struct scsi_device *sdev, char *id, void *ref,
|
|
|
|
+ u32 mask, int set_or_clear)
|
|
{
|
|
{
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+
|
|
if (set_or_clear == ZFCP_SET) {
|
|
if (set_or_clear == ZFCP_SET) {
|
|
- if (status_change_set(mask, &unit->status))
|
|
|
|
- zfcp_dbf_rec_unit(id, ref, unit);
|
|
|
|
- atomic_set_mask(mask, &unit->status);
|
|
|
|
|
|
+ if (status_change_set(mask, &zfcp_sdev->status))
|
|
|
|
+ zfcp_dbf_rec_lun(id, ref, sdev);
|
|
|
|
+ atomic_set_mask(mask, &zfcp_sdev->status);
|
|
} else {
|
|
} else {
|
|
- if (status_change_clear(mask, &unit->status))
|
|
|
|
- zfcp_dbf_rec_unit(id, ref, unit);
|
|
|
|
- atomic_clear_mask(mask, &unit->status);
|
|
|
|
|
|
+ if (status_change_clear(mask, &zfcp_sdev->status))
|
|
|
|
+ zfcp_dbf_rec_lun(id, ref, sdev);
|
|
|
|
+ atomic_clear_mask(mask, &zfcp_sdev->status);
|
|
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) {
|
|
if (mask & ZFCP_STATUS_COMMON_ERP_FAILED) {
|
|
- atomic_set(&unit->erp_counter, 0);
|
|
|
|
|
|
+ atomic_set(&zfcp_sdev->erp_counter, 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1563,16 +1582,16 @@ void zfcp_erp_port_boxed(struct zfcp_port *port, char *id, void *ref)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_boxed - Mark unit as "boxed" and start ERP
|
|
|
|
- * @port: The "boxed" unit.
|
|
|
|
|
|
+ * zfcp_erp_lun_boxed - Mark LUN as "boxed" and start ERP
|
|
|
|
+ * @sdev: The "boxed" SCSI device / LUN.
|
|
* @id: The debug trace id.
|
|
* @id: The debug trace id.
|
|
- * @id: Reference for the debug trace.
|
|
|
|
|
|
+ * @ref: Reference for the debug trace.
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_boxed(struct zfcp_unit *unit, char *id, void *ref)
|
|
|
|
|
|
+void zfcp_erp_lun_boxed(struct scsi_device *sdev, char *id, void *ref)
|
|
{
|
|
{
|
|
- zfcp_erp_modify_unit_status(unit, id, ref,
|
|
|
|
- ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
|
|
|
|
- zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
|
|
|
|
|
+ zfcp_erp_modify_lun_status(sdev, id, ref,
|
|
|
|
+ ZFCP_STATUS_COMMON_ACCESS_BOXED, ZFCP_SET);
|
|
|
|
+ zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1582,7 +1601,7 @@ void zfcp_erp_unit_boxed(struct zfcp_unit *unit, char *id, void *ref)
|
|
* @ref: reference for debug trace
|
|
* @ref: reference for debug trace
|
|
*
|
|
*
|
|
* Since the adapter has denied access, stop using the port and the
|
|
* Since the adapter has denied access, stop using the port and the
|
|
- * attached units.
|
|
|
|
|
|
+ * attached LUNs.
|
|
*/
|
|
*/
|
|
void zfcp_erp_port_access_denied(struct zfcp_port *port, char *id, void *ref)
|
|
void zfcp_erp_port_access_denied(struct zfcp_port *port, char *id, void *ref)
|
|
{
|
|
{
|
|
@@ -1592,44 +1611,44 @@ void zfcp_erp_port_access_denied(struct zfcp_port *port, char *id, void *ref)
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * zfcp_erp_unit_access_denied - Adapter denied access to unit.
|
|
|
|
- * @unit: unit where access has been denied
|
|
|
|
|
|
+ * zfcp_erp_lun_access_denied - Adapter denied access to LUN.
|
|
|
|
+ * @sdev: SCSI device / LUN where access has been denied
|
|
* @id: id for debug trace
|
|
* @id: id for debug trace
|
|
* @ref: reference for debug trace
|
|
* @ref: reference for debug trace
|
|
*
|
|
*
|
|
- * Since the adapter has denied access, stop using the unit.
|
|
|
|
|
|
+ * Since the adapter has denied access, stop using the LUN.
|
|
*/
|
|
*/
|
|
-void zfcp_erp_unit_access_denied(struct zfcp_unit *unit, char *id, void *ref)
|
|
|
|
|
|
+void zfcp_erp_lun_access_denied(struct scsi_device *sdev, char *id, void *ref)
|
|
{
|
|
{
|
|
- zfcp_erp_modify_unit_status(unit, id, ref,
|
|
|
|
- ZFCP_STATUS_COMMON_ERP_FAILED |
|
|
|
|
- ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
|
|
|
|
|
|
+ zfcp_erp_modify_lun_status(sdev, id, ref,
|
|
|
|
+ ZFCP_STATUS_COMMON_ERP_FAILED |
|
|
|
|
+ ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
|
|
}
|
|
}
|
|
|
|
|
|
-static void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, char *id,
|
|
|
|
- void *ref)
|
|
|
|
|
|
+static void zfcp_erp_lun_access_changed(struct scsi_device *sdev, char *id,
|
|
|
|
+ void *ref)
|
|
{
|
|
{
|
|
- int status = atomic_read(&unit->status);
|
|
|
|
|
|
+ struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
|
|
|
|
+ int status = atomic_read(&zfcp_sdev->status);
|
|
|
|
+
|
|
if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
ZFCP_STATUS_COMMON_ACCESS_BOXED)))
|
|
ZFCP_STATUS_COMMON_ACCESS_BOXED)))
|
|
return;
|
|
return;
|
|
|
|
|
|
- zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
|
|
|
|
|
+ zfcp_erp_lun_reopen(sdev, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
|
|
}
|
|
}
|
|
|
|
|
|
static void zfcp_erp_port_access_changed(struct zfcp_port *port, char *id,
|
|
static void zfcp_erp_port_access_changed(struct zfcp_port *port, char *id,
|
|
void *ref)
|
|
void *ref)
|
|
{
|
|
{
|
|
- struct zfcp_unit *unit;
|
|
|
|
- unsigned long flags;
|
|
|
|
|
|
+ struct scsi_device *sdev;
|
|
int status = atomic_read(&port->status);
|
|
int status = atomic_read(&port->status);
|
|
|
|
|
|
if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
if (!(status & (ZFCP_STATUS_COMMON_ACCESS_DENIED |
|
|
ZFCP_STATUS_COMMON_ACCESS_BOXED))) {
|
|
ZFCP_STATUS_COMMON_ACCESS_BOXED))) {
|
|
- read_lock_irqsave(&port->unit_list_lock, flags);
|
|
|
|
- list_for_each_entry(unit, &port->unit_list, list)
|
|
|
|
- zfcp_erp_unit_access_changed(unit, id, ref);
|
|
|
|
- read_unlock_irqrestore(&port->unit_list_lock, flags);
|
|
|
|
|
|
+ shost_for_each_device(sdev, port->adapter->scsi_host)
|
|
|
|
+ if (sdev_to_zfcp(sdev)->port == port)
|
|
|
|
+ zfcp_erp_lun_access_changed(sdev, id, ref);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|