Index: sys/kern/vfs_subr.c =================================================================== --- sys/kern/vfs_subr.c +++ sys/kern/vfs_subr.c @@ -1746,8 +1746,6 @@ ((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_VNDIRTY | BX_VNCLEAN); @@ -1782,10 +1780,9 @@ bp->b_flags &= ~B_ASYNC; brelse(bp); BO_LOCK(bo); - nbp = gbincore(bo, lblkno); - if (nbp == NULL || (nbp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) - != xflags) - break; /* nbp invalid */ + if (nbp == NULL || (nbp = gbincore(bo, lblkno)) == NULL || + (nbp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN)) != xflags) + break; /* loop is finished or nbp is invalid */ } return (retval); }