In physio(), the after_unlock code assumes that b_resid is valid, but that value is only assigned if we actually call (*strategy)(), which doesn't happen if uvm_vslock_device() fails.
None of that error handling code is actually needed if uvm_vslock_device() fails, so just break out of the loop instead of faking a buf failure. ok? Diff also available on Rietveld at http://codereview.appspot.com/4639095/ Index: kern/kern_physio.c =================================================================== RCS file: /home/mdempsky/anoncvs/cvs/src/sys/kern/kern_physio.c,v retrieving revision 1.33 diff -u -p -r1.33 kern_physio.c --- kern/kern_physio.c 8 May 2011 09:07:06 -0000 1.33 +++ kern/kern_physio.c 27 Jun 2011 22:03:39 -0000 @@ -141,11 +141,8 @@ physio(void (*strategy)(struct buf *), d error = uvm_vslock_device(p, iovp->iov_base, todo, (flags & B_READ) ? VM_PROT_READ | VM_PROT_WRITE : VM_PROT_READ, &map); - if (error) { - bp->b_flags |= B_ERROR; - bp->b_error = error; - goto after_unlock; - } + if (error) + goto done; if (map) { bp->b_data = map; } else { @@ -183,7 +180,6 @@ physio(void (*strategy)(struct buf *), d if (!map) vunmapbuf(bp, todo); uvm_vsunlock_device(p, iovp->iov_base, todo, map); -after_unlock: /* remember error value (save a splbio/splx pair) */ if (bp->b_flags & B_ERROR)
