All of lore.kernel.org
 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 4/6] scsi: hpsa: Ignore HBA flag from NVRAM if logical devices exist
Date: Fri, 14 Dec 2018 18:21:13 +0500	[thread overview]
Message-ID: <20181214132115.21440-5-mironov.ivan@gmail.com> (raw)
In-Reply-To: <20181214132115.21440-1-mironov.ivan@gmail.com>

Simultaneous use of physical devices and logical RAID devices may be
dangerous.

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

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 60f1f7949d8d..0b5b3a651b70 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -4364,10 +4364,11 @@ static int hpsa_nvram_hba_flag_enabled(struct ctlr_info *h, bool *flag_enabled)
 	return rc;
 }
 
-static int hpsa_update_nvram_hba_mode(struct ctlr_info *h)
+static int hpsa_update_nvram_hba_mode(struct ctlr_info *h, u32 nlogicals)
 {
 	int rc;
 	bool flag_enabled;
+	bool ignore;
 
 	if (!hpsa_use_nvram_hba_flag)
 		return 0;
@@ -4378,10 +4379,13 @@ static int hpsa_update_nvram_hba_mode(struct ctlr_info *h)
 	if (rc)
 		return rc;
 
-	dev_info(&h->pdev->dev, "NVRAM HBA flag: %s\n",
-		flag_enabled ? "enabled" : "disabled");
+	ignore = flag_enabled && nlogicals;
 
-	h->nvram_hba_mode_enabled = flag_enabled;
+	dev_info(&h->pdev->dev, "NVRAM HBA flag: %s%s\n",
+		flag_enabled ? "enabled" : "disabled",
+		ignore ? " (ignored because of existing logical devices)" : "");
+
+	h->nvram_hba_mode_enabled = flag_enabled && !ignore;
 
 	return 0;
 }
@@ -4442,7 +4446,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
 			__func__);
 	}
 
-	if (hpsa_update_nvram_hba_mode(h)) {
+	if (hpsa_update_nvram_hba_mode(h, nlogicals)) {
 		h->drv_req_rescan = 1;
 		goto out;
 	}
-- 
2.19.2


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

Thread overview: 13+ 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 ` [PATCH 3/6] scsi: hpsa: Add/mask existing devices on rescan if visibility changes Ivan Mironov
2018-12-14 13:21 ` Ivan Mironov [this message]
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 19:38   ` Don.Brace
2018-12-14 20:30   ` Ivan Mironov
2018-12-17 16:32     ` Don.Brace
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-5-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.