Module Name: src
Committed By: hannken
Date: Thu Jan 17 10:20:01 UTC 2019
Modified Files:
src/sys/dev/pci: ld_virtio.c
Log Message:
Use cv_broadcast() on "sc_sync_wait" to prevent deadlock
when more than one thread try to "DIOCCACHESYNC" at the
same time.
To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/ld_virtio.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ld_virtio.c
diff -u src/sys/dev/pci/ld_virtio.c:1.26 src/sys/dev/pci/ld_virtio.c:1.27
--- src/sys/dev/pci/ld_virtio.c:1.26 Fri Nov 23 18:08:11 2018
+++ src/sys/dev/pci/ld_virtio.c Thu Jan 17 10:20:01 2019
@@ -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 @@ ld_virtio_vq_done1(struct ld_virtio_soft
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 @@ ld_virtio_flush(struct ld_softc *ld, boo
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;