All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme: honour O_NONBLOCK during resetting
@ 2021-11-11 10:59 Hannes Reinecke
  2021-11-16  1:40 ` Chaitanya Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Hannes Reinecke @ 2021-11-11 10:59 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke

When opening a controller device node we should honour the O_NONBLOCK
flag to allow the device to be openend even if it's in state 'resetting'
or 'connecting'. This allows user-space applications to use a call to 'open'
to figure out if the controller is present, even if it's currently
undergoing a reset.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/host/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 74980a1cf89e..67cde3eaf5b0 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3136,6 +3136,11 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
 	switch (ctrl->state) {
 	case NVME_CTRL_LIVE:
 		break;
+	case NVME_CTRL_RESETTING:
+	case NVME_CTRL_CONNECTING:
+		if (file->f_flags & O_NONBLOCK)
+			break;
+		fallthrough;
 	default:
 		return -EWOULDBLOCK;
 	}
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-16  7:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 10:59 [PATCH] nvme: honour O_NONBLOCK during resetting Hannes Reinecke
2021-11-16  1:40 ` Chaitanya Kulkarni
2021-11-16  2:18   ` Keith Busch
2021-11-16  6:54     ` Hannes Reinecke
2021-11-16  6:52   ` Hannes Reinecke

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.