summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authorluoqi <luoqi@FreeBSD.org>1999-09-03 17:49:25 +0000
committerluoqi <luoqi@FreeBSD.org>1999-09-03 17:49:25 +0000
commitdfe06dcb7dab9702d70ebfc05107600f1cd2d1a4 (patch)
tree5a4398551bc2e1496f0f019564bcbb86fdfc478d /sys/kern/vfs_bio.c
parent7d240ed5811f23450d10fd4d4c6eb1e1a3459dde (diff)
downloadFreeBSD-src-dfe06dcb7dab9702d70ebfc05107600f1cd2d1a4.zip
FreeBSD-src-dfe06dcb7dab9702d70ebfc05107600f1cd2d1a4.tar.gz
Allow getblk() to be called from an idle context (by panic() inside
an interrupt handler). Reviewed by: dillon
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 6b03775..2f8f85a 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1374,7 +1374,7 @@ restart:
dbp = NULL;
outofspace = 0;
if (bufspace >= hibufspace) {
- if ((curproc->p_flag & P_BUFEXHAUST) == 0 ||
+ if ((curproc && (curproc->p_flag & P_BUFEXHAUST) == 0) ||
bufspace >= maxbufspace) {
outofspace = 1;
if (defrag > 0)
@@ -1406,7 +1406,7 @@ restart:
* constantly out of space or in need of defragmentation.
*/
- if ((curproc->p_flag & P_BUFEXHAUST) == 0 &&
+ if (curproc && (curproc->p_flag & P_BUFEXHAUST) == 0 &&
numfreebuffers < lofreebuffers) {
nqindex = QUEUE_CLEAN;
nbp = NULL;
@@ -1992,9 +1992,15 @@ loop:
/*
* Block if we are low on buffers. Certain processes are allowed
* to completely exhaust the buffer cache.
- */
- if (curproc->p_flag & P_BUFEXHAUST) {
+ *
+ * If this check ever becomes a bottleneck it may be better to
+ * move it into the else, when gbincore() fails. At the moment
+ * it isn't a problem.
+ */
+ if (!curproc || (curproc->p_flag & P_BUFEXHAUST)) {
if (numfreebuffers == 0) {
+ if (!curproc)
+ return NULL;
needsbuffer |= VFS_BIO_NEED_ANY;
tsleep(&needsbuffer, (PRIBIO + 4) | slpflag, "newbuf",
slptimeo);
OpenPOWER on IntegriCloud