Commit 0a609298 authored by Don Brace's avatar Don Brace Committed by Greg Kroah-Hartman

scsi: hpsa: update check for logical volume status


[ Upstream commit 85b29008 ]

 - Add in a new case for volume offline. Resolves internal testing bug
   for multilun array management.
 - Return correct status for failed TURs.
Reviewed-by: default avatarScott Benesh <scott.benesh@microsemi.com>
Reviewed-by: default avatarScott Teel <scott.teel@microsemi.com>
Signed-off-by: default avatarDon Brace <don.brace@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b0def6f1
...@@ -3466,7 +3466,7 @@ static int hpsa_get_volume_status(struct ctlr_info *h, ...@@ -3466,7 +3466,7 @@ static int hpsa_get_volume_status(struct ctlr_info *h,
* # (integer code indicating one of several NOT READY states * # (integer code indicating one of several NOT READY states
* describing why a volume is to be kept offline) * describing why a volume is to be kept offline)
*/ */
static int hpsa_volume_offline(struct ctlr_info *h, static unsigned char hpsa_volume_offline(struct ctlr_info *h,
unsigned char scsi3addr[]) unsigned char scsi3addr[])
{ {
struct CommandList *c; struct CommandList *c;
...@@ -3486,7 +3486,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, ...@@ -3486,7 +3486,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,
rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT); rc = hpsa_scsi_do_simple_cmd(h, c, DEFAULT_REPLY_QUEUE, NO_TIMEOUT);
if (rc) { if (rc) {
cmd_free(h, c); cmd_free(h, c);
return 0; return HPSA_VPD_LV_STATUS_UNSUPPORTED;
} }
sense = c->err_info->SenseInfo; sense = c->err_info->SenseInfo;
if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo)) if (c->err_info->SenseLen > sizeof(c->err_info->SenseInfo))
...@@ -3497,19 +3497,13 @@ static int hpsa_volume_offline(struct ctlr_info *h, ...@@ -3497,19 +3497,13 @@ static int hpsa_volume_offline(struct ctlr_info *h,
cmd_status = c->err_info->CommandStatus; cmd_status = c->err_info->CommandStatus;
scsi_status = c->err_info->ScsiStatus; scsi_status = c->err_info->ScsiStatus;
cmd_free(h, c); cmd_free(h, c);
/* Is the volume 'not ready'? */
if (cmd_status != CMD_TARGET_STATUS ||
scsi_status != SAM_STAT_CHECK_CONDITION ||
sense_key != NOT_READY ||
asc != ASC_LUN_NOT_READY) {
return 0;
}
/* Determine the reason for not ready state */ /* Determine the reason for not ready state */
ldstat = hpsa_get_volume_status(h, scsi3addr); ldstat = hpsa_get_volume_status(h, scsi3addr);
/* Keep volume offline in certain cases: */ /* Keep volume offline in certain cases: */
switch (ldstat) { switch (ldstat) {
case HPSA_LV_FAILED:
case HPSA_LV_UNDERGOING_ERASE: case HPSA_LV_UNDERGOING_ERASE:
case HPSA_LV_NOT_AVAILABLE: case HPSA_LV_NOT_AVAILABLE:
case HPSA_LV_UNDERGOING_RPI: case HPSA_LV_UNDERGOING_RPI:
...@@ -3531,7 +3525,7 @@ static int hpsa_volume_offline(struct ctlr_info *h, ...@@ -3531,7 +3525,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,
default: default:
break; break;
} }
return 0; return HPSA_LV_OK;
} }
/* /*
...@@ -3615,10 +3609,10 @@ static int hpsa_update_device_info(struct ctlr_info *h, ...@@ -3615,10 +3609,10 @@ static int hpsa_update_device_info(struct ctlr_info *h,
/* Do an inquiry to the device to see what it is. */ /* Do an inquiry to the device to see what it is. */
if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff, if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
(unsigned char) OBDR_TAPE_INQ_SIZE) != 0) { (unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
/* Inquiry failed (msg printed already) */
dev_err(&h->pdev->dev, dev_err(&h->pdev->dev,
"hpsa_update_device_info: inquiry failed\n"); "%s: inquiry failed, device will be skipped.\n",
rc = -EIO; __func__);
rc = HPSA_INQUIRY_FAILED;
goto bail_out; goto bail_out;
} }
...@@ -3638,15 +3632,19 @@ static int hpsa_update_device_info(struct ctlr_info *h, ...@@ -3638,15 +3632,19 @@ static int hpsa_update_device_info(struct ctlr_info *h,
if (this_device->devtype == TYPE_DISK && if (this_device->devtype == TYPE_DISK &&
is_logical_dev_addr_mode(scsi3addr)) { is_logical_dev_addr_mode(scsi3addr)) {
int volume_offline; unsigned char volume_offline;
hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level); hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC) if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
hpsa_get_ioaccel_status(h, scsi3addr, this_device); hpsa_get_ioaccel_status(h, scsi3addr, this_device);
volume_offline = hpsa_volume_offline(h, scsi3addr); volume_offline = hpsa_volume_offline(h, scsi3addr);
if (volume_offline < 0 || volume_offline > 0xff) if (volume_offline == HPSA_LV_FAILED) {
volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED; rc = HPSA_LV_FAILED;
this_device->volume_offline = volume_offline & 0xff; dev_err(&h->pdev->dev,
"%s: LV failed, device will be skipped.\n",
__func__);
goto bail_out;
}
} else { } else {
this_device->raid_level = RAID_UNKNOWN; this_device->raid_level = RAID_UNKNOWN;
this_device->offload_config = 0; this_device->offload_config = 0;
...@@ -4115,8 +4113,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h) ...@@ -4115,8 +4113,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
goto out; goto out;
} }
if (rc) { if (rc) {
dev_warn(&h->pdev->dev, h->drv_req_rescan = 1;
"Inquiry failed, skipping device.\n");
continue; continue;
} }
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
#define CFGTBL_BusType_Fibre2G 0x00000200l #define CFGTBL_BusType_Fibre2G 0x00000200l
/* VPD Inquiry types */ /* VPD Inquiry types */
#define HPSA_INQUIRY_FAILED 0x02
#define HPSA_VPD_SUPPORTED_PAGES 0x00 #define HPSA_VPD_SUPPORTED_PAGES 0x00
#define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1 #define HPSA_VPD_LV_DEVICE_GEOMETRY 0xC1
#define HPSA_VPD_LV_IOACCEL_STATUS 0xC2 #define HPSA_VPD_LV_IOACCEL_STATUS 0xC2
...@@ -164,6 +165,7 @@ ...@@ -164,6 +165,7 @@
/* Logical volume states */ /* Logical volume states */
#define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff #define HPSA_VPD_LV_STATUS_UNSUPPORTED 0xff
#define HPSA_LV_OK 0x0 #define HPSA_LV_OK 0x0
#define HPSA_LV_FAILED 0x01
#define HPSA_LV_NOT_AVAILABLE 0x0b #define HPSA_LV_NOT_AVAILABLE 0x0b
#define HPSA_LV_UNDERGOING_ERASE 0x0F #define HPSA_LV_UNDERGOING_ERASE 0x0F
#define HPSA_LV_UNDERGOING_RPI 0x12 #define HPSA_LV_UNDERGOING_RPI 0x12
......
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