From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH] nvme: block ioctls if controller not in a live state
Date: Mon, 7 May 2018 15:55:58 -0700 [thread overview]
Message-ID: <20180507225558.5009-1-jsmart2021@gmail.com> (raw)
Rather than allow ioctl-based admin cmds to get intermixed on the admin
queue with commands being used to initialize a controller or io commands
to go to a controller in reconnect thus possibly hanging, reject them
if the controller isn't in the LIVE state. Reject with an -EAGAIN status
so that the app knows it could retry.
Signed-off-by: James Smart <james.smart at broadcom.com>
---
drivers/nvme/host/core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a3771c5729f5..cfa03b68d2b8 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1041,6 +1041,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio)
return -EFAULT;
if (io.flags)
return -EINVAL;
+ if (ns->ctrl->state != NVME_CTRL_LIVE)
+ return -EAGAIN;
switch (io.opcode) {
case nvme_cmd_write:
@@ -1174,6 +1176,8 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
return -EFAULT;
if (cmd.flags)
return -EINVAL;
+ if (ctrl->state != NVME_CTRL_LIVE)
+ return -EAGAIN;
memset(&c, 0, sizeof(c));
c.common.opcode = cmd.opcode;
--
2.13.1
next reply other threads:[~2018-05-07 22:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-07 22:55 James Smart [this message]
2018-05-08 7:15 ` [PATCH] nvme: block ioctls if controller not in a live state Johannes Thumshirn
2018-05-09 23:20 ` James Smart
2018-05-11 5:13 ` Johannes Thumshirn
2018-05-09 5:11 ` Christoph Hellwig
2018-05-09 16:29 ` James Smart
2018-05-14 14:17 ` Christoph Hellwig
2018-05-14 14:47 ` James Smart
2018-05-14 14:53 ` Christoph Hellwig
2018-06-12 23:11 ` James Smart
2018-06-13 8:09 ` Christoph Hellwig
2018-06-13 14:56 ` James Smart
2018-05-14 15:23 ` Keith Busch
2018-05-14 15:48 ` James Smart
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=20180507225558.5009-1-jsmart2021@gmail.com \
--to=jsmart2021@gmail.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).