Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci Use cv_broadcast() on "sc_sync_wait" to prevent ...



details:   https://anonhg.NetBSD.org/src/rev/d346a996a497
branches:  trunk
changeset: 996048:d346a996a497
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Jan 17 10:20:01 2019 +0000

description:
Use cv_broadcast() on "sc_sync_wait" to prevent deadlock
when more than one thread try to "DIOCCACHESYNC" at the
same time.

diffstat:

 sys/dev/pci/ld_virtio.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r e72e0438927a -r d346a996a497 sys/dev/pci/ld_virtio.c
--- a/sys/dev/pci/ld_virtio.c   Thu Jan 17 10:18:52 2019 +0000
+++ b/sys/dev/pci/ld_virtio.c   Thu Jan 17 10:20:01 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ld_virtio.c,v 1.26 2018/11/23 18:08:11 jmcneill Exp $  */
+/*     $NetBSD: ld_virtio.c,v 1.27 2019/01/17 10:20:01 hannken Exp $   */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.26 2018/11/23 18:08:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.27 2019/01/17 10:20:01 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -465,7 +465,7 @@
                mutex_enter(&sc->sc_sync_wait_lock);
                sc->sc_sync_status = vr->vr_status;
                sc->sc_sync_use = SYNC_DONE;
-               cv_signal(&sc->sc_sync_wait);
+               cv_broadcast(&sc->sc_sync_wait);
                mutex_exit(&sc->sc_sync_wait_lock);
                virtio_dequeue_commit(vsc, vq, slot);
                return;
@@ -716,7 +716,7 @@
                r = EIO;
 
        sc->sc_sync_use = SYNC_FREE;
-       cv_signal(&sc->sc_sync_wait);
+       cv_broadcast(&sc->sc_sync_wait);
        mutex_exit(&sc->sc_sync_wait_lock);
 
        return r;



Home | Main Index | Thread Index | Old Index