Print this page
OS-1987 disks in zpools never go away when pulled

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/devcfg.c
          +++ new/usr/src/uts/common/os/devcfg.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  24   24   * Copyright 2012 Garrett D'Amore <garrett@damore.org>.  All rights reserved.
       25 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  25   26   */
  26   27  
  27   28  #include <sys/note.h>
  28   29  #include <sys/t_lock.h>
  29   30  #include <sys/cmn_err.h>
  30   31  #include <sys/instance.h>
  31   32  #include <sys/conf.h>
  32   33  #include <sys/stat.h>
  33   34  #include <sys/ddi.h>
  34   35  #include <sys/hwconf.h>
↓ open down ↓ 5848 lines elided ↑ open up ↑
5883 5884          }
5884 5885  
5885 5886          if (flags & NDI_POST_EVENT) {
5886 5887                  if (i_ddi_devi_attached(pdip)) {
5887 5888                          if (ddi_get_eventcookie(dip, DDI_DEVI_REMOVE_EVENT,
5888 5889                              &cookie) == NDI_SUCCESS)
5889 5890                                  (void) ndi_post_event(dip, dip, cookie, NULL);
5890 5891                  }
5891 5892          }
5892 5893  
     5894 +        /*
     5895 +         * dv_mknod places a hold on the dev_info_t for each devfs node
     5896 +         * created.  If we're to succeed in detaching this device, we must
     5897 +         * first release all outstanding references held by devfs.
     5898 +         */
     5899 +        (void) devfs_clean(pdip, NULL, DV_CLEAN_FORCE);
     5900 +
5893 5901          if (i_ddi_detachchild(dip, flags) != DDI_SUCCESS) {
5894 5902                  if (flags & NDI_DEVI_OFFLINE) {
5895 5903                          RIO_DEBUG((CE_NOTE, "devi_detach_node: offline failed."
5896 5904                              " Calling e_ddi_offline_finalize with result=%d. "
5897 5905                              "dip=%p", DDI_FAILURE, (void *)dip));
5898 5906                          e_ddi_offline_finalize(dip, DDI_FAILURE);
5899 5907                  }
5900 5908                  return (NDI_FAILURE);
5901 5909          }
5902 5910  
↓ open down ↓ 3285 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX