- for (offset = 0; isize; isize -= PAGE_SIZE,
- offset += PAGE_SIZE) {
- blkno = ubc_offtoblk(vp, (off_t)f_offset);
- f_offset += PAGE_SIZE;
- if ((bp = incore(vp, blkno)) &&
- ISSET(bp->b_flags, B_BUSY)) {
- ubc_upl_abort_range(vpupl, offset, PAGE_SIZE,
- UPL_ABORT_FREE_ON_EMPTY);
- result = error = PAGER_ERROR;
- continue;
- } else if (bp) {
- bremfree(bp);
- SET(bp->b_flags, B_BUSY | B_INVAL);
- brelse(bp);
+ /*
+ * if the file has been effectively deleted, then
+ * we need to go through the UPL and invalidate any
+ * buffer headers we might have that reference any
+ * of it's pages
+ */
+ for (offset = upl_offset; isize; isize -= PAGE_SIZE, offset += PAGE_SIZE) {
+#if NFSCLIENT
+ if (vp->v_tag == VT_NFS)
+ /* check with nfs if page is OK to drop */
+ error = nfs_buf_page_inval(vp, (off_t)f_offset);
+ else
+#endif
+ {
+ blkno = ubc_offtoblk(vp, (off_t)f_offset);
+ error = buf_invalblkno(vp, blkno, 0);
+ }
+ if (error) {
+ if ( !(flags & UPL_NOCOMMIT))
+ ubc_upl_abort_range(upl, offset, PAGE_SIZE, UPL_ABORT_FREE_ON_EMPTY);
+ if (error_ret == 0)
+ error_ret = error;
+ result = PAGER_ERROR;
+
+ } else if ( !(flags & UPL_NOCOMMIT)) {
+ ubc_upl_commit_range(upl, offset, PAGE_SIZE, UPL_COMMIT_FREE_ON_EMPTY);