Instead of trying to biowait on a buf that has errored, do the
authorthib <thib@openbsd.org>
Thu, 22 Jul 2010 14:34:06 +0000 (14:34 +0000)
committerthib <thib@openbsd.org>
Thu, 22 Jul 2010 14:34:06 +0000 (14:34 +0000)
right thing, throw it away by marking it as B_INVAL and setting
the B_ERROR flag and b_error to the errno that was returned.

B_RAW doesn't matter there.

Issue report my mlarkin@, this diff tested and confirmed to
fix the issue by mlarkin also, thanks!

OK krw@, beck@, deraadt@

sys/dev/vnd.c

index 75dc8ca..995525a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vnd.c,v 1.99 2010/07/01 17:48:33 thib Exp $   */
+/*     $OpenBSD: vnd.c,v 1.100 2010/07/22 14:34:06 thib Exp $  */
 /*     $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $        */
 
 /*
@@ -660,24 +660,29 @@ vndiodone(struct buf *bp)
                DNPRINTF(VDB_IO, "vndiodone: vbp %p error %d\n", vbp,
                    vbp->vb_buf.b_error);
 
-               pbp->b_flags |= B_ERROR;
-               /* XXX does this matter here? */
-               (&vbp->vb_buf)->b_flags |= B_RAW;
-               pbp->b_error = biowait(&vbp->vb_buf);
+               pbp->b_flags |= (B_ERROR|B_INVAL);
+               pbp->b_error = vbp->vb_buf.b_error;
+               pbp->b_iodone = NULL;
+               biodone(pbp);
+               goto out;
        }
+
        pbp->b_resid -= vbp->vb_buf.b_bcount;
+
+       if (pbp->b_resid == 0) {
+               DNPRINTF(VDB_IO, "vndiodone: pbp %p iodone\n", pbp);
+               biodone(pbp);
+       }
+
+out:
        putvndbuf(vbp);
+
        if (vnd->sc_tab.b_active) {
                disk_unbusy(&vnd->sc_dk, (pbp->b_bcount - pbp->b_resid),
                    (pbp->b_flags & B_READ));
                if (!vnd->sc_tab.b_actf)
                        vnd->sc_tab.b_active--;
        }
-       if (pbp->b_resid == 0) {
-               DNPRINTF(VDB_IO, "vndiodone: pbp %p iodone\n", pbp);
-               biodone(pbp);
-       }
-
 }
 
 /* ARGSUSED */