summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Telka <marcel.telka@nexenta.com>2014-02-12 14:30:17 +0100
committerDan McDonald <danmcd@omniti.com>2014-02-18 16:36:16 -0500
commit197c9523b8946cf70fab2bc4ee633b18fc5bde68 (patch)
tree40646dbfaae0e5d167aec5fcc92b53ec39355484
parent6ab697caaefb599dda8c2839feec7322d7cf45bb (diff)
downloadillumos-joyent-197c9523b8946cf70fab2bc4ee633b18fc5bde68.tar.gz
4123 Locks should not be held across the call to ddi_periodic_delete(9f)
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com> Reviewed by: Joshua M. Clulow <josh@sysmgr.org> Reviewed by: Garrett D'Amore <garrett@damore.org> Reviewed by: David Pacheco <dap@joyent.com> Approved by: Dan McDonald <danmcd@omniti.com>
-rw-r--r--usr/src/man/man9f/ddi_periodic_delete.9f12
-rw-r--r--usr/src/man/man9f/untimeout.9f5
-rw-r--r--usr/src/uts/common/io/audio/impl/audio_engine.c8
-rw-r--r--usr/src/uts/common/io/iprb/iprb.c7
4 files changed, 24 insertions, 8 deletions
diff --git a/usr/src/man/man9f/ddi_periodic_delete.9f b/usr/src/man/man9f/ddi_periodic_delete.9f
index c8fdf8cb75..84cd2d8990 100644
--- a/usr/src/man/man9f/ddi_periodic_delete.9f
+++ b/usr/src/man/man9f/ddi_periodic_delete.9f
@@ -1,10 +1,11 @@
'\" te
+.\" Copyright 2014 Nexenta Systems, Inc. All rights reserved.
.\" Copyright 2013, Joyent, Inc. All Rights Reserved.
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
.\" the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH DDI_PERIODIC_DELETE 9F "Jul 23, 2013"
+.TH DDI_PERIODIC_DELETE 9F "Feb 12, 2014"
.SH NAME
ddi_periodic_delete \- cancel periodic function invocation requests
.SH SYNOPSIS
@@ -45,8 +46,13 @@ context routine, such as the \fBdetach\fR(9E) entry point of a module.
.LP
If the callback function is already executing (for instance, on another CPU)
when the request is cancelled, \fBddi_periodic_delete()\fR will block until
-it finishes executing and is completely unregistered. The callback will not
-be invoked again after the call to \fBddi_periodic_delete()\fR returns.
+it finishes executing and is completely unregistered. Because of this, locks
+acquired by the callback function must not be held across the call to
+\fBddi_periodic_delete()\fR or a deadlock may result.
+.sp
+.LP
+The callback will not be invoked again after the call to
+\fBddi_periodic_delete()\fR returns.
.SH CONTEXT
.sp
.LP
diff --git a/usr/src/man/man9f/untimeout.9f b/usr/src/man/man9f/untimeout.9f
index b6b867cf95..7c169e962b 100644
--- a/usr/src/man/man9f/untimeout.9f
+++ b/usr/src/man/man9f/untimeout.9f
@@ -1,10 +1,11 @@
'\" te
+.\" Copyright 2014 Nexenta Systems, Inc. All rights reserved.
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
-.TH UNTIMEOUT 9F "Jan 16, 2006"
+.TH UNTIMEOUT 9F "Feb 12, 2014"
.SH NAME
untimeout \- cancel previous timeout function call
.SH SYNOPSIS
@@ -37,7 +38,7 @@ Opaque timeout \fBID\fR from a previous \fBtimeout\fR(9F) call.
.LP
The \fBuntimeout()\fR function cancels a pending \fBtimeout\fR(9F) request.
\fBuntimeout()\fR will not return until the pending callback is cancelled or
-has run. Because of this, locks acquired by the callback routine should not be
+has run. Because of this, locks acquired by the callback routine must not be
held across the call to \fBuntimeout()\fR or a deadlock may result.
.sp
.LP
diff --git a/usr/src/uts/common/io/audio/impl/audio_engine.c b/usr/src/uts/common/io/audio/impl/audio_engine.c
index b62d4ecd3e..2f5bd3075a 100644
--- a/usr/src/uts/common/io/audio/impl/audio_engine.c
+++ b/usr/src/uts/common/io/audio/impl/audio_engine.c
@@ -22,6 +22,7 @@
* Copyright (C) 4Front Technologies 1996-2008.
*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
#include <sys/types.h>
@@ -836,11 +837,13 @@ auimpl_engine_close(audio_stream_t *sp)
{
audio_engine_t *e = sp->s_engine;
audio_dev_t *d;
+ ddi_periodic_t ep;
if (e == NULL)
return;
d = e->e_dev;
+ ep = 0;
mutex_enter(&d->d_lock);
while (d->d_suspended) {
@@ -852,13 +855,16 @@ auimpl_engine_close(audio_stream_t *sp)
list_remove(&e->e_streams, sp);
if (list_is_empty(&e->e_streams)) {
ENG_STOP(e);
- ddi_periodic_delete(e->e_periodic);
+ ep = e->e_periodic;
e->e_periodic = 0;
e->e_flags &= ENGINE_DRIVER_FLAGS;
ENG_CLOSE(e);
}
mutex_exit(&e->e_lock);
+ if (ep != 0)
+ ddi_periodic_delete(ep);
+
cv_broadcast(&d->d_cv);
mutex_exit(&d->d_lock);
}
diff --git a/usr/src/uts/common/io/iprb/iprb.c b/usr/src/uts/common/io/iprb/iprb.c
index 29d0a03320..14952254b9 100644
--- a/usr/src/uts/common/io/iprb/iprb.c
+++ b/usr/src/uts/common/io/iprb/iprb.c
@@ -10,7 +10,7 @@
*/
/*
- * Copyright 2010 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -1313,9 +1313,12 @@ iprb_m_stop(void *arg)
} else {
mac_link_update(ip->mach, LINK_STATE_DOWN);
}
+
+ ddi_periodic_delete(ip->perh);
+ ip->perh = 0;
+
mutex_enter(&ip->rulock);
mutex_enter(&ip->culock);
- ddi_periodic_delete(ip->perh);
if (!ip->suspended) {
iprb_update_stats(ip);