From ae3c8799daed67832db23a2957d5f5e47250cad9 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 13 Mar 2003 07:19:23 +0000 Subject: - Remove a race between fsync like functions and flushbufqueues() by requiring locked bufs in vfs_bio_awrite(). Previously the buf could have been written out by fsync before we acquired the buf lock if it weren't for giant. The cluster_wbuild() handles this race properly but the single write at the end of vfs_bio_awrite() would not. - Modify flushbufqueues() so there is only one copy of the loop. Pass a parameter in that says whether or not we should sync bufs with deps. - Call flushbufqueues() a second time and then break if we couldn't find any bufs without deps. --- sys/ufs/ffs/ffs_vnops.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'sys/ufs') diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index cc6debc..8aa3db4 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -227,7 +227,6 @@ loop: */ if (passes > 0 || !wait) { if ((bp->b_flags & B_CLUSTEROK) && !wait) { - BUF_UNLOCK(bp); (void) vfs_bio_awrite(bp); } else { bremfree(bp); @@ -252,10 +251,9 @@ loop: splx(s); brelse(bp); s = splbio(); - } else { - BUF_UNLOCK(bp); + } else vfs_bio_awrite(bp); - } + /* * Since we may have slept during the I/O, we need * to start from a known point. -- cgit v1.1