From 941da355cfc43d2a500b829fbb2bf19355e19e99 Mon Sep 17 00:00:00 2001 From: chs Date: Sat, 10 Mar 2001 18:43:55 +0000 Subject: [PATCH] in getnewbuf(), when we need to write a buffer before reusing it, return NULL instead of restarting the loop since we might sleep while starting the i/o. this tells getblk() to check if someone else created the buffer while we slept. from OpenBSD. --- sys/kern/vfs_bio.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 11cd4f374a94..08168b507a31 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.74 2000/12/13 17:48:46 jdolecek Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.75 2001/03/10 18:43:55 chs Exp $ */ /*- * Copyright (c) 1994 Christopher G. Demetriou @@ -830,7 +830,10 @@ start: /* Buffer is no longer on free lists. */ SET(bp->b_flags, B_BUSY); - /* If buffer was a delayed write, start it, and go back to the top. */ + /* + * If buffer was a delayed write, start it and return NULL + * (since we might sleep while starting the write). + */ if (ISSET(bp->b_flags, B_DELWRI)) { splx(s); /* @@ -839,7 +842,7 @@ start: */ SET(bp->b_flags, B_AGE); bawrite(bp); - goto start; + return (NULL); } /* disassociate us from our vnode, if we had one... */