linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ivan Mironov <mironov.ivan@gmail.com>
To: linux-scsi@vger.kernel.org, mironov.ivan@gmail.com
Cc: linux-kernel@vger.kernel.org, Don Brace <don.brace@microsemi.com>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	esc.storagedev@microsemi.com
Subject: [PATCH 3/6] scsi: hpsa: Add/mask existing devices on rescan if visibility changes
Date: Fri, 14 Dec 2018 18:21:12 +0500	[thread overview]
Message-ID: <20181214132115.21440-4-mironov.ivan@gmail.com> (raw)
In-Reply-To: <20181214132115.21440-1-mironov.ivan@gmail.com>

Controller may be switched between RAID and HBA modes even without a
reboot.

When changing to HBA mode, it does some internal reset magic and
automatically removes any configured RAID arrays. Without this patch,
driver successfully detects disappearance of logical arrays, but does
not expose any physical disks.

Signed-off-by: Ivan Mironov <mironov.ivan@gmail.com>
---
 drivers/scsi/hpsa.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ee3d7c722a63..60f1f7949d8d 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1541,6 +1541,14 @@ static inline int device_updated(struct hpsa_scsi_dev_t *dev1,
 	return 0;
 }
 
+static inline bool device_expose_changed(struct hpsa_scsi_dev_t *dev1,
+	struct hpsa_scsi_dev_t *dev2)
+{
+	if (dev1->expose_device != dev2->expose_device)
+		return true;
+	return false;
+}
+
 /* Find needle in haystack.  If exact match found, return DEVICE_SAME,
  * and return needle location in *index.  If scsi3addr matches, but not
  * vendor, model, serial num, etc. return DEVICE_CHANGED, and return needle
@@ -1569,6 +1577,8 @@ static int hpsa_scsi_find_entry(struct hpsa_scsi_dev_t *needle,
 			if (device_is_the_same(needle, haystack[i])) {
 				if (device_updated(needle, haystack[i]))
 					return DEVICE_UPDATED;
+				if (device_expose_changed(needle, haystack[i]))
+					return DEVICE_CHANGED;
 				return DEVICE_SAME;
 			} else {
 				/* Keep offline devices offline */
-- 
2.19.2


  parent reply	other threads:[~2018-12-14 13:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 13:21 [PATCH 0/6] Add support of the HBA mode on HP Smart Array P410i controllers Ivan Mironov
2018-12-14 13:21 ` [PATCH 1/6] scsi: hpsa: Add function to check if device is a disk or a zoned device Ivan Mironov
2018-12-14 13:26   ` Johannes Thumshirn
2018-12-14 13:21 ` [PATCH 2/6] scsi: hpsa: Support HBA mode on HP Smart Array P410i controllers Ivan Mironov
2018-12-14 13:21 ` Ivan Mironov [this message]
2018-12-14 13:21 ` [PATCH 4/6] scsi: hpsa: Ignore HBA flag from NVRAM if logical devices exist Ivan Mironov
2018-12-14 13:21 ` [PATCH 5/6] scsi: hpsa: Name more fields in "struct bmic_identify_controller" Ivan Mironov
2018-12-14 13:21 ` [PATCH 6/6] scsi: hpsa: Do not use HBA flag from NVRAM if HBA is not supported Ivan Mironov
2018-12-14 19:38 ` [PATCH 0/6] Add support of the HBA mode on HP Smart Array P410i controllers Don.Brace
2018-12-14 20:30   ` Ivan Mironov
2018-12-17 16:32     ` Don.Brace

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=20181214132115.21440-4-mironov.ivan@gmail.com \
    --to=mironov.ivan@gmail.com \
    --cc=don.brace@microsemi.com \
    --cc=esc.storagedev@microsemi.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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;
as well as URLs for NNTP newsgroup(s).