Source-Changes-HG archive

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

[src/trunk]: src/sys/dev rnd_add_uint32() doens't support concurent calls for...



details:   https://anonhg.NetBSD.org/src/rev/b1bf42d090eb
branches:  trunk
changeset: 446144:b1bf42d090eb
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sat Nov 24 18:09:13 2018 +0000

description:
rnd_add_uint32() doens't support concurent calls for the same rnd_source,
call it with dksc->sc_iolock held.

diffstat:

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

diffs (32 lines):

diff -r 2e79077efd55 -r b1bf42d090eb sys/dev/dksubr.c
--- a/sys/dev/dksubr.c  Sat Nov 24 17:54:18 2018 +0000
+++ b/sys/dev/dksubr.c  Sat Nov 24 18:09:13 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.103 2018/09/03 16:29:30 riastradh Exp $ */
+/* $NetBSD: dksubr.c,v 1.104 2018/11/24 18:09:13 bouyer Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.103 2018/09/03 16:29:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.104 2018/11/24 18:09:13 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -460,11 +460,11 @@
        if (lock)
                mutex_enter(&dksc->sc_iolock);
        disk_unbusy(dk, bp->b_bcount - bp->b_resid, (bp->b_flags & B_READ));
-       if (lock)
-               mutex_exit(&dksc->sc_iolock);
 
        if ((dksc->sc_flags & DKF_NO_RND) == 0)
                rnd_add_uint32(&dksc->sc_rnd_source, bp->b_rawblkno);
+       if (lock)
+               mutex_exit(&dksc->sc_iolock);
 
        biodone(bp);
 }



Home | Main Index | Thread Index | Old Index