From d3b1b2cc99641538c58e8937d2f63e3a9aa5b867 Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 16 Jan 2005 21:09:39 +0000 Subject: Fix a bug I introduced in 1.561 which has caused considerable filesystem unhappiness lately. As far as I can tell, no files that have made it safely to disk have been endangered, but stuff in transit has been in peril. Pointy hat: phk --- sys/kern/vfs_subr.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/kern/vfs_subr.c') diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 006d6e3..1052702 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -956,7 +956,7 @@ vinvalbuf(vp, flags, td, slpflag, slptimeo) if (error == 0) error = flushbuflist(&bo->bo_dirty, flags, vp, slpflag, slptimeo); - if (error != EAGAIN) { + if (error != 0 && error != EAGAIN) { BO_UNLOCK(bo); return (error); } @@ -1011,19 +1011,19 @@ flushbuflist(bufv, flags, vp, slpflag, slptimeo) int slpflag, slptimeo; { struct buf *bp, *nbp; - int found, error; + int retval, error; struct bufobj *bo; bo = &vp->v_bufobj; ASSERT_BO_LOCKED(bo); - found = 0; + retval = 0; TAILQ_FOREACH_SAFE(bp, &bufv->bv_hd, b_bobufs, nbp) { if (((flags & V_NORMAL) && (bp->b_xflags & BX_ALTDATA)) || ((flags & V_ALT) && (bp->b_xflags & BX_ALTDATA) == 0)) { continue; } - found += 1; + retval = EAGAIN; error = BUF_TIMELOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, BO_MTX(bo), "flushbuf", slpflag, slptimeo); @@ -1063,7 +1063,7 @@ flushbuflist(bufv, flags, vp, slpflag, slptimeo) brelse(bp); BO_LOCK(bo); } - return (found ? EAGAIN : 0); + return (retval); } /* -- cgit v1.1