summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-01-16 21:09:39 +0000
committerphk <phk@FreeBSD.org>2005-01-16 21:09:39 +0000
commitd3b1b2cc99641538c58e8937d2f63e3a9aa5b867 (patch)
treeb87757f5ee2932ddc273b5df300c8fdde7bbfb63
parent5568092622753fcc85db602f130361a6db42f249 (diff)
downloadFreeBSD-src-d3b1b2cc99641538c58e8937d2f63e3a9aa5b867.zip
FreeBSD-src-d3b1b2cc99641538c58e8937d2f63e3a9aa5b867.tar.gz
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
-rw-r--r--sys/kern/vfs_subr.c10
1 files changed, 5 insertions, 5 deletions
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);
}
/*
OpenPOWER on IntegriCloud