Break out of loop if next buffer pointer has become invalid while flushing
current buffer. Reviewed by: kan
This commit is contained in:
parent
fead0681ed
commit
61ac14dab6
@ -1081,6 +1081,8 @@ flushbuflist(bufv, flags, bo, slpflag, slptimeo)
|
||||
{
|
||||
struct buf *bp, *nbp;
|
||||
int retval, error;
|
||||
daddr_t lblkno;
|
||||
b_xflags_t xflags;
|
||||
|
||||
ASSERT_BO_LOCKED(bo);
|
||||
|
||||
@ -1090,6 +1092,13 @@ flushbuflist(bufv, flags, bo, slpflag, slptimeo)
|
||||
((flags & V_ALT) && (bp->b_xflags & BX_ALTDATA) == 0)) {
|
||||
continue;
|
||||
}
|
||||
lblkno = 0;
|
||||
xflags = 0;
|
||||
if (nbp != NULL) {
|
||||
lblkno = nbp->b_lblkno;
|
||||
xflags = nbp->b_xflags &
|
||||
(BX_BKGRDMARKER | BX_VNDIRTY | BX_VNCLEAN);
|
||||
}
|
||||
retval = EAGAIN;
|
||||
error = BUF_TIMELOCK(bp,
|
||||
LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK, BO_MTX(bo),
|
||||
@ -1125,6 +1134,12 @@ flushbuflist(bufv, flags, bo, slpflag, slptimeo)
|
||||
bp->b_flags &= ~B_ASYNC;
|
||||
brelse(bp);
|
||||
BO_LOCK(bo);
|
||||
if (nbp != NULL &&
|
||||
(nbp->b_bufobj != bo ||
|
||||
nbp->b_lblkno != lblkno ||
|
||||
(nbp->b_xflags &
|
||||
(BX_BKGRDMARKER | BX_VNDIRTY | BX_VNCLEAN)) != xflags))
|
||||
break; /* nbp invalid */
|
||||
}
|
||||
return (retval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user