Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/jdolecek-ncq]: src/sys/dev/ata take atabus_qlock while inserting into at...
details: https://anonhg.NetBSD.org/src/rev/0c5aab92fe75
branches: jdolecek-ncq
changeset: 352748:0c5aab92fe75
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Sat Aug 12 15:08:38 2017 +0000
description:
take atabus_qlock while inserting into atabus_initq_head to avoid race
in attach and rescan; just cleanup, noticed this while doing the thread
locking, don't think there is realistic way to trigger this
diffstat:
sys/dev/ata/ata.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diffs (38 lines):
diff -r e65e5ec46cc7 -r 0c5aab92fe75 sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Sat Aug 12 14:41:54 2017 +0000
+++ b/sys/dev/ata/ata.c Sat Aug 12 15:08:38 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $ */
+/* $NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.26 2017/08/12 14:41:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.27 2017/08/12 15:08:38 jdolecek Exp $");
#include "opt_ata.h"
@@ -711,7 +711,9 @@
initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
initq->atabus_sc = sc;
+ mutex_enter(&atabus_qlock);
TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq);
+ mutex_exit(&atabus_qlock);
config_pending_incr(sc->sc_dev);
if ((error = kthread_create(PRI_NONE, 0, NULL, atabus_thread, sc,
@@ -2390,7 +2392,9 @@
initq = malloc(sizeof(*initq), M_DEVBUF, M_WAITOK);
initq->atabus_sc = sc;
+ mutex_enter(&atabus_qlock);
TAILQ_INSERT_TAIL(&atabus_initq_head, initq, atabus_initq);
+ mutex_exit(&atabus_qlock);
config_pending_incr(sc->sc_dev);
mutex_enter(&chp->ch_lock);
Home |
Main Index |
Thread Index |
Old Index