From 57e978edac2d1a55f2d9b8ab313aa6f3d6324e69 Mon Sep 17 00:00:00 2001 From: bouyer Date: Sat, 24 Nov 2018 18:09:13 +0000 Subject: [PATCH] rnd_add_uint32() doens't support concurent calls for the same rnd_source, call it with dksc->sc_iolock held. --- sys/dev/dksubr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/dksubr.c b/sys/dev/dksubr.c index d12e3e616c55..72b61bafbf6c 100644 --- a/sys/dev/dksubr.c +++ b/sys/dev/dksubr.c @@ -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 -__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 #include @@ -460,11 +460,11 @@ dk_done1(struct dk_softc *dksc, struct buf *bp, bool lock) 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); }