Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Async event can be called before the adapter ...
details: https://anonhg.NetBSD.org/src/rev/541c86169369
branches: trunk
changeset: 355141:541c86169369
user: christos <christos%NetBSD.org@localhost>
date: Fri Jul 14 17:50:11 2017 +0000
description:
Async event can be called before the adapter is running (pmax tc asc)
diffstat:
sys/dev/scsipi/scsipi_base.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r 4dac4fab8ec5 -r 541c86169369 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c Fri Jul 14 17:30:31 2017 +0000
+++ b/sys/dev/scsipi/scsipi_base.c Fri Jul 14 17:50:11 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.178 2017/07/14 17:50:11 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_scsi.h"
@@ -2238,8 +2238,10 @@
scsipi_async_event(struct scsipi_channel *chan, scsipi_async_event_t event,
void *arg)
{
+ bool lock = chan_running(chan) > 0;
- mutex_enter(chan_mtx(chan));
+ if (lock)
+ mutex_enter(chan_mtx(chan));
switch (event) {
case ASYNC_EVENT_MAX_OPENINGS:
scsipi_async_event_max_openings(chan,
@@ -2256,7 +2258,8 @@
scsipi_async_event_channel_reset(chan);
break;
}
- mutex_exit(chan_mtx(chan));
+ if (lock)
+ mutex_exit(chan_mtx(chan));
}
/*
Home |
Main Index |
Thread Index |
Old Index