public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jethro Beekman <kernel@jbeekman.nl>
To: keith.busch@intel.com, axboe@fb.com,
	linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org
Cc: Jethro Beekman <kernel@jbeekman.nl>
Subject: [PATCH 1/3] nvme: When scanning namespaces, make sure the drive is not locked
Date: Sun, 19 Jun 2016 16:06:32 -0700	[thread overview]
Message-ID: <20160619230634.17229-2-kernel@jbeekman.nl> (raw)
In-Reply-To: <20160619230634.17229-1-kernel@jbeekman.nl>

Signed-off-by: Jethro Beekman <kernel@jbeekman.nl>
---
 drivers/nvme/host/core.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 643f457..3a0d48c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1377,6 +1377,12 @@ static void __nvme_scan_namespaces(struct nvme_ctrl *ctrl, unsigned nn)
 	}
 }
 
+static bool nvme_security_is_locked(struct nvme_ctrl *ctrl,
+		struct nvme_id_ctrl *id)
+{
+	return false;
+}
+
 void nvme_scan_namespaces(struct nvme_ctrl *ctrl)
 {
 	struct nvme_id_ctrl *id;
@@ -1385,6 +1391,11 @@ void nvme_scan_namespaces(struct nvme_ctrl *ctrl)
 	if (nvme_identify_ctrl(ctrl, &id))
 		return;
 
+	if (nvme_security_is_locked(ctrl, id)) {
+		nvme_remove_namespaces(ctrl);
+		return;
+	}
+
 	mutex_lock(&ctrl->namespaces_mutex);
 	nn = le32_to_cpu(id->nn);
 	if (ctrl->vs >= NVME_VS(1, 1) &&
-- 
2.9.0

  reply	other threads:[~2016-06-19 23:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-19 23:06 [PATCH 0/3] nvme: Don't add namespaces for locked drives Jethro Beekman
2016-06-19 23:06 ` Jethro Beekman [this message]
2016-06-24  8:12   ` [PATCH 1/3] nvme: When scanning namespaces, make sure the drive is not locked Christoph Hellwig
2016-06-19 23:06 ` [PATCH 2/3] nvme: Add function for NVMe security receive command Jethro Beekman
2016-06-19 23:06 ` [PATCH 3/3] nvme: Check if drive is locked using ATA Security Jethro Beekman
2016-06-24  8:09   ` Christoph Hellwig
2016-06-20  6:46 ` [PATCH 0/3] nvme: Don't add namespaces for locked drives Sagi Grimberg
2016-06-24  8:09   ` Christoph Hellwig
2016-06-20 15:26 ` Keith Busch
2016-06-20 18:21   ` Jethro Beekman
2016-06-20 22:54     ` Keith Busch
2016-06-21  3:50       ` Jethro Beekman
2016-06-24  7:43         ` Christoph Hellwig
2016-06-24  8:11   ` Christoph Hellwig
2016-06-24  7:37 ` Christoph Hellwig
2016-06-24  7:45   ` Jethro Beekman
2016-06-24  8:00     ` Christoph Hellwig

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=20160619230634.17229-2-kernel@jbeekman.nl \
    --to=kernel@jbeekman.nl \
    --cc=axboe@fb.com \
    --cc=keith.busch@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.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