Print this page
XXXX don't fail device detach when it's physically removed

@@ -16,13 +16,14 @@
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
  */
+
 /*
  * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
  * Copyright 2012 Garrett D'Amore <garrett@damore.org>.  All rights reserved.
  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  * Copyright (c) 2016 by Delphix. All rights reserved.
  */
 

@@ -1358,12 +1359,12 @@
         int             rv;
 
         ASSERT(DEVI_BUSY_OWNED(ddi_get_parent(dip)));
         ASSERT(i_ddi_node_state(dip) == DS_ATTACHED);
 
-        /* check references */
-        if (DEVI(dip)->devi_ref)
+        /* Check references */
+        if (DEVI(dip)->devi_ref != 0 && !DEVI(dip)->devi_gone)
                 return (DDI_FAILURE);
 
         NDI_CONFIG_DEBUG((CE_CONT, "detach_node: 0x%p(%s%d)\n",
             (void *)dip, ddi_driver_name(dip), ddi_get_instance(dip)));
 

@@ -3819,12 +3820,12 @@
  * with argument "ioc@xxxxxxx,yyyyyyy:port=1". After configuring
  * the ioc, look for minor node dhcp. If not found, pass ":dhcp"
  * to ioc's bus_config entry point.
  */
 int
-resolve_pathname(char *pathname,
-        dev_info_t **dipp, dev_t *devtp, int *spectypep)
+resolve_pathname(char *pathname, dev_info_t **dipp, dev_t *devtp,
+    int *spectypep)
 {
         int                     error;
         dev_info_t              *parent, *child;
         struct pathname         pn;
         char                    *component, *config_name;