Print this page
OS-1987 disks in zpools never go away when pulled
@@ -20,10 +20,11 @@
*/
/*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
+ * Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
#include <sys/note.h>
#include <sys/t_lock.h>
#include <sys/cmn_err.h>
@@ -5888,10 +5889,17 @@
&cookie) == NDI_SUCCESS)
(void) ndi_post_event(dip, dip, cookie, NULL);
}
}
+ /*
+ * dv_mknod places a hold on the dev_info_t for each devfs node
+ * created. If we're to succeed in detaching this device, we must
+ * first release all outstanding references held by devfs.
+ */
+ (void) devfs_clean(pdip, NULL, DV_CLEAN_FORCE);
+
if (i_ddi_detachchild(dip, flags) != DDI_SUCCESS) {
if (flags & NDI_DEVI_OFFLINE) {
RIO_DEBUG((CE_NOTE, "devi_detach_node: offline failed."
" Calling e_ddi_offline_finalize with result=%d. "
"dip=%p", DDI_FAILURE, (void *)dip));