mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Don Brace <don.brace@microsemi.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 4.4 024/101] scsi: hpsa: update check for logical volume status
Date: Thu, 7 Dec 2017 15:50:17 +0000	[thread overview]
Message-ID: <20171207155005.5852-24-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171207155005.5852-1-alexander.levin@verizon.com>

From: Don Brace <don.brace@microsemi.com>

[ Upstream commit 85b29008d8af6d94a0723aaa8d93cfb6e041158b ]

 - Add in a new case for volume offline. Resolves internal testing bug
   for multilun array management.
 - Return correct status for failed TURs.

Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 drivers/scsi/hpsa.c     | 35 ++++++++++++++++-------------------
 drivers/scsi/hpsa_cmd.h |  2 ++
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index e9ce74afd13f..09f0de8fb2d9 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3466,7 +3466,7 @@ exit_failed:
  *  # (integer code indicating one of several NOT READY states
  *     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[])
 {
 	struct CommandList *c;
@@ -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);
 	if (rc) {
 		cmd_free(h, c);
-		return 0;
+		return HPSA_VPD_LV_STATUS_UNSUPPORTED;
 	}
 	sense = 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,
 	cmd_status = c->err_info->CommandStatus;
 	scsi_status = c->err_info->ScsiStatus;
 	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 */
 	ldstat = hpsa_get_volume_status(h, scsi3addr);
 
 	/* Keep volume offline in certain cases: */
 	switch (ldstat) {
+	case HPSA_LV_FAILED:
 	case HPSA_LV_UNDERGOING_ERASE:
 	case HPSA_LV_NOT_AVAILABLE:
 	case HPSA_LV_UNDERGOING_RPI:
@@ -3531,7 +3525,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,
 	default:
 		break;
 	}
-	return 0;
+	return HPSA_LV_OK;
 }
 
 /*
@@ -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. */
 	if (hpsa_scsi_do_inquiry(h, scsi3addr, 0, inq_buff,
 		(unsigned char) OBDR_TAPE_INQ_SIZE) != 0) {
-		/* Inquiry failed (msg printed already) */
 		dev_err(&h->pdev->dev,
-			"hpsa_update_device_info: inquiry failed\n");
-		rc = -EIO;
+			"%s: inquiry failed, device will be skipped.\n",
+			__func__);
+		rc = HPSA_INQUIRY_FAILED;
 		goto bail_out;
 	}
 
@@ -3638,15 +3632,19 @@ static int hpsa_update_device_info(struct ctlr_info *h,
 
 	if (this_device->devtype == TYPE_DISK &&
 		is_logical_dev_addr_mode(scsi3addr)) {
-		int volume_offline;
+		unsigned char volume_offline;
 
 		hpsa_get_raid_level(h, scsi3addr, &this_device->raid_level);
 		if (h->fw_support & MISC_FW_RAID_OFFLOAD_BASIC)
 			hpsa_get_ioaccel_status(h, scsi3addr, this_device);
 		volume_offline = hpsa_volume_offline(h, scsi3addr);
-		if (volume_offline < 0 || volume_offline > 0xff)
-			volume_offline = HPSA_VPD_LV_STATUS_UNSUPPORTED;
-		this_device->volume_offline = volume_offline & 0xff;
+		if (volume_offline == HPSA_LV_FAILED) {
+			rc = HPSA_LV_FAILED;
+			dev_err(&h->pdev->dev,
+				"%s: LV failed, device will be skipped.\n",
+				__func__);
+			goto bail_out;
+		}
 	} else {
 		this_device->raid_level = RAID_UNKNOWN;
 		this_device->offload_config = 0;
@@ -4115,8 +4113,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 			goto out;
 		}
 		if (rc) {
-			dev_warn(&h->pdev->dev,
-				"Inquiry failed, skipping device.\n");
+			h->drv_req_rescan = 1;
 			continue;
 		}
 
diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
index d92ef0d352b5..26488e2a7f02 100644
--- a/drivers/scsi/hpsa_cmd.h
+++ b/drivers/scsi/hpsa_cmd.h
@@ -155,6 +155,7 @@
 #define CFGTBL_BusType_Fibre2G  0x00000200l
 
 /* VPD Inquiry types */
+#define HPSA_INQUIRY_FAILED		0x02
 #define HPSA_VPD_SUPPORTED_PAGES        0x00
 #define HPSA_VPD_LV_DEVICE_GEOMETRY     0xC1
 #define HPSA_VPD_LV_IOACCEL_STATUS      0xC2
@@ -164,6 +165,7 @@
 /* Logical volume states */
 #define HPSA_VPD_LV_STATUS_UNSUPPORTED			0xff
 #define HPSA_LV_OK                                      0x0
+#define HPSA_LV_FAILED					0x01
 #define HPSA_LV_NOT_AVAILABLE				0x0b
 #define HPSA_LV_UNDERGOING_ERASE			0x0F
 #define HPSA_LV_UNDERGOING_RPI				0x12
-- 
2.11.0

  parent reply	other threads:[~2017-12-07 15:53 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 15:50 [PATCH AUTOSEL for 4.4 001/101] usb: phy: isp1301: Add OF device ID table alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 004/101] userfaultfd: selftest: vm: allow to build in vm/ directory alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 005/101] net: initialize msg.msg_flags in recvfrom alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 003/101] userfaultfd: shmem: __do_fault requires VM_FAULT_NOPAGE alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 002/101] md-cluster: free md_cluster_info if node leave cluster alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 007/101] net: bcmgenet: correct MIB access of UniMAC RUNT counters alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 006/101] net: bcmgenet: correct the RBUF_OVFL_CNT and RBUF_ERR_CNT MIB values alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 008/101] net: bcmgenet: reserved phy revisions must be checked first alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 012/101] NFSD: fix nfsd_reset_versions for NFSv4 alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 011/101] NFSD: fix nfsd_minorversion(.., NFSD_AVAIL) alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 010/101] net: bcmgenet: Power up the internal PHY before probing the MII alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 009/101] net: bcmgenet: power down internal phy if open or resume fails alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 013/101] Input: i8042 - add TUXEDO BU1406 (N24_25BU) to the nomux list alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 015/101] netfilter: bridge: honor frag_max_size when refragmenting alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 017/101] net: wimax/i2400m: fix NULL-deref at probe alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 016/101] writeback: fix memory leak in wb_queue_work() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 014/101] drm/omap: fix dmabuf mmap for dma_alloc'ed buffers alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 018/101] dmaengine: Fix array index out of bounds warning in __get_unmap_pool() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 019/101] net: Resend IGMP memberships upon peer notification alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 021/101] mlxsw: reg: Fix SPVMLR max record count alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 020/101] mlxsw: reg: Fix SPVM " alexander.levin
2017-12-07 15:50 ` alexander.levin [this message]
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 022/101] intel_th: pci: Add Gemini Lake support alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 023/101] openrisc: fix issue handling 8 byte get_user calls alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 025/101] scsi: hpsa: limit outstanding rescans alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 029/101] sched/deadline: Throttle a constrained deadline task activated after the deadline alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 028/101] sched/deadline: Make sure the replenishment timer fires in the next period alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 027/101] drm/radeon/si: add dpm quirk for Oland alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 026/101] fjes: Fix wrong netdevice feature flags alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 030/101] sched/deadline: Use deadline instead of period when calculating overflow alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 033/101] afs: Fix missing put_page() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 032/101] drm/radeon: reinstate oland workaround for sclk alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 031/101] mmc: mediatek: Fixed bug where clock frequency could be set wrong alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 035/101] afs: Adjust mode bits processing alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 036/101] afs: Flush outstanding writes when an fd is closed alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 034/101] afs: Populate group ID from vnode status alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 037/101] afs: Migrate vlocation fields to 64-bit alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 040/101] afs: Populate and use client modification time alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 038/101] afs: Prevent callback expiry timer overflow alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 039/101] afs: Fix the maths in afs_fs_store_data() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 041/101] afs: Fix page leak in afs_write_begin() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 044/101] perf symbols: Fix symbols__fixup_end heuristic for corner cases alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 045/101] efi/esrt: Cleanup bad memory map log messages alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 043/101] net/mlx4_core: Avoid delays during VF driver device shutdown alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 042/101] afs: Fix afs_kill_pages() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 049/101] target: fix ALUA transition timeout handling alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 047/101] btrfs: add missing memset while reading compressed inline extents alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 048/101] target: Use system workqueue for ALUA transitions alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 046/101] NFSv4.1 respect server's max size in CREATE_SESSION alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 051/101] sfc: don't warn on successful change of MAC alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 050/101] target: fix race during implicit transition work flushes alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 053/101] video: udlfb: Fix read EDID timeout alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 052/101] fbdev: controlfb: Add missing modes to fix out of bounds access alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 055/101] video: fbdev: au1200fb: Return an error code if a memory allocation fails alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 056/101] rtc: pcf8563: fix output clock rate alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 054/101] video: fbdev: au1200fb: Release some resources if a memory allocation fails alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 057/101] ASoC: cs42l56: Fix reset GPIO name in example DT binding alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 060/101] powerpc/powernv/cpufreq: Fix the frequency read by /proc/cpuinfo alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 058/101] dmaengine: ti-dma-crossbar: Correct am335x/am43xx mux value type alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 059/101] PCI/PME: Handle invalid data when reading Root Status alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 061/101] netfilter: ipvs: Fix inappropriate output of procfs alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 065/101] target/iscsi: Fix a race condition in iscsit_add_reject_from_cmd() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 062/101] powerpc/opal: Fix EBUSY bug in acquiring tokens alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 064/101] platform/x86: sony-laptop: Fix error handling in sony_nc_setup_rfkill() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 063/101] powerpc/ipic: Fix status get and status clear alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 067/101] target:fix condition return in core_pr_dump_initiator_port() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 066/101] iscsi-target: fix memory leak in lio_target_tiqn_addtpg() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 068/101] target/file: Do not return error for UNMAP if length is zero alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 069/101] arm-ccn: perf: Prevent module unload while PMU is in use alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 070/101] crypto: tcrypt - fix buffer lengths in test_aead_speed() alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 073/101] clk: imx6: refine hdmi_isfr's parent to make HDMI work on i.MX6 SoCs w/o VPU alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 072/101] clk: mediatek: add the option for determining PLL source clock alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 071/101] mm: Handle 0 flags in _calc_vm_trans() macro alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 077/101] GFS2: Take inode off order_write list when setting jdata flag alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 076/101] thermal/drivers/step_wise: Fix temperature regulation misbehavior alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 074/101] clk: tegra: Fix cclk_lp divisor register alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 075/101] ppp: Destroy the mutex when cleanup alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 080/101] l2tp: cleanup l2tp_tunnel_delete calls alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 078/101] bcache: explicitly destroy mutex while exiting alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 081/101] xfs: fix log block underflow during recovery cycle verification alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 082/101] xfs: fix incorrect extent state in xfs_bmap_add_extent_unwritten_real alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 084/101] scsi: hpsa: cleanup sas_phy structures in sysfs when unloading alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 083/101] PCI: Detach driver before procfs & sysfs teardown on device remove alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 085/101] scsi: hpsa: destroy sas transport properties before scsi_host alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 088/101] dmaengine: rcar-dmac: use TCRB instead of TCR for residue alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 086/101] powerpc/perf/hv-24x7: Fix incorrect comparison in memord alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 087/101] tty fix oops when rmmod 8250 alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 089/101] pinctrl: adi2: Fix Kconfig build problem alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 093/101] ASoC: samsung: i2s: disable secondary DAI until it gets fixed alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 092/101] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 091/101] scsi: scsi_devinfo: Add REPORTLUN2 to EMC SYMMETRIX blacklist entry alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 090/101] raid5: Set R5_Expanded on parity devices as well as data alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 097/101] udf: Avoid overflow when session starts at large offset alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 094/101] scsi: sd: change manage_start_stop to bool in sysfs interface alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 095/101] scsi: sd: change allow_restart " alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 096/101] scsi: bfa: integer overflow in debugfs alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 099/101] RDMA/cma: Avoid triggering undefined behavior alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 101/101] ath9k: fix tx99 potential info leak alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 100/101] IB/ipoib: Grab rtnl lock on heavy flush when calling ndo_open/stop alexander.levin
2017-12-07 15:50 ` [PATCH AUTOSEL for 4.4 098/101] macvlan: Only deliver one copy of the frame to the macvlan interface alexander.levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207155005.5852-24-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=don.brace@microsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®