- /* If it's not cacheable, or an error, mark it invalid. */
- if (ISSET(bp->nb_flags, (NB_NOCACHE|NB_ERROR)))
+ /* If it's non-needcommit nocache, or an error, mark it invalid. */
+ if (ISSET(bp->nb_flags, NB_ERROR) ||
+ (ISSET(bp->nb_flags, NB_NOCACHE) && !ISSET(bp->nb_flags, (NB_NEEDCOMMIT | NB_DELWRI))))