Module Name: src Committed By: pgoyette Date: Mon Dec 26 23:15:15 UTC 2016
Modified Files: src/sys/kern: vfs_bio.c Log Message: Fix locking so we don't release the lock between the time we check the tailq (for being non-empty) and the time we remove an entry. To generate a diff of this commit: cvs rdiff -u -r1.264 -r1.265 src/sys/kern/vfs_bio.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/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.264 src/sys/kern/vfs_bio.c:1.265 --- src/sys/kern/vfs_bio.c:1.264 Mon Dec 26 23:12:33 2016 +++ src/sys/kern/vfs_bio.c Mon Dec 26 23:15:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.264 2016/12/26 23:12:33 pgoyette Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.265 2016/12/26 23:15:15 pgoyette Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.264 2016/12/26 23:12:33 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.265 2016/12/26 23:15:15 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_bufcache.h" @@ -1647,17 +1647,20 @@ biointr(void *cookie) ci = curcpu(); + s = splvm(); while (!TAILQ_EMPTY(&ci->ci_data.cpu_biodone)) { KASSERT(curcpu() == ci); - s = splvm(); bp = TAILQ_FIRST(&ci->ci_data.cpu_biodone); TAILQ_REMOVE(&ci->ci_data.cpu_biodone, bp, b_actq); splx(s); KERNHIST_LOG(biohist, "bp=%p", bp, 0, 0, 0); biodone2(bp); + + s = splvm(); } + splx(s); } /*