nvme: check for a live controller in nvme_dev_open

This is a much more sensible check than just the admin queue.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@rimbeg.me>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
This commit is contained in:
Christoph Hellwig 2017-10-18 17:09:31 +02:00
parent a6a5149b10
commit 999ada2871
1 changed files with 1 additions and 1 deletions

View File

@ -1891,7 +1891,7 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
struct nvme_ctrl *ctrl =
container_of(inode->i_cdev, struct nvme_ctrl, cdev);
if (!ctrl->admin_q)
if (ctrl->state != NVME_CTRL_LIVE)
return -EWOULDBLOCK;
file->private_data = ctrl;
return 0;