Skip to content

Commit

Permalink
OS-7882 nvmeadm attach/detach of ignored namespace causes panic
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <rm+illumos@fingolfin.org>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
  • Loading branch information
hrosenfeld committed Sep 9, 2019
1 parent b36aca9 commit b0dbab4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions usr/src/uts/common/io/nvme/nvme.c
Expand Up @@ -4446,6 +4446,9 @@ nvme_ioctl_detach(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, int mode,
if (nsid == 0)
return (EINVAL);

if (nvme->n_ns[nsid - 1].ns_ignore)
return (0);

rv = bd_detach_handle(nvme->n_ns[nsid - 1].ns_bd_hdl);
if (rv != DDI_SUCCESS)
rv = EBUSY;
Expand Down Expand Up @@ -4476,6 +4479,14 @@ nvme_ioctl_attach(nvme_t *nvme, int nsid, nvme_ioctl_t *nioc, int mode,

kmem_free(idns, sizeof (nvme_identify_nsid_t));

if (nvme->n_ns[nsid - 1].ns_ignore)
return (ENOTSUP);

if (nvme->n_ns[nsid - 1].ns_bd_hdl == NULL)
nvme->n_ns[nsid - 1].ns_bd_hdl = bd_alloc_handle(
&nvme->n_ns[nsid - 1], &nvme_bd_ops, &nvme->n_prp_dma_attr,
KM_SLEEP);

rv = bd_attach_handle(nvme->n_dip, nvme->n_ns[nsid - 1].ns_bd_hdl);
if (rv != DDI_SUCCESS)
rv = EBUSY;
Expand Down

0 comments on commit b0dbab4

Please sign in to comment.