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:
parent
a6a5149b10
commit
999ada2871
|
@ -1891,7 +1891,7 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
|
||||||
struct nvme_ctrl *ctrl =
|
struct nvme_ctrl *ctrl =
|
||||||
container_of(inode->i_cdev, struct nvme_ctrl, cdev);
|
container_of(inode->i_cdev, struct nvme_ctrl, cdev);
|
||||||
|
|
||||||
if (!ctrl->admin_q)
|
if (ctrl->state != NVME_CTRL_LIVE)
|
||||||
return -EWOULDBLOCK;
|
return -EWOULDBLOCK;
|
||||||
file->private_data = ctrl;
|
file->private_data = ctrl;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue