kernel - Clear bp->b_error prior to initiating write I/O
authorMatthew Dillon <dillon@apollo.backplane.com>
Sun, 29 Jul 2018 02:01:39 +0000 (19:01 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 13 Aug 2018 00:17:01 +0000 (17:17 -0700)
* Clear bp->b_error prior to initiating write I/O so a lingering
  b_error code from a retry that later succeeds is not retained.

sys/kern/vfs_bio.c

index 7ef914c..2b5fd7f 100644 (file)
@@ -997,6 +997,7 @@ bwrite(struct buf *bp)
        bp->b_flags &= ~(B_ERROR | B_EINTR);
        bp->b_flags |= B_CACHE;
        bp->b_cmd = BUF_CMD_WRITE;
+       bp->b_error = 0;
        bp->b_bio1.bio_done = biodone_sync;
        bp->b_bio1.bio_flags |= BIO_SYNC;
        vfs_busy_pages(bp->b_vp, bp);
@@ -1044,6 +1045,7 @@ bawrite(struct buf *bp)
        bp->b_flags &= ~(B_ERROR | B_EINTR);
        bp->b_flags |= B_CACHE;
        bp->b_cmd = BUF_CMD_WRITE;
+       bp->b_error = 0;
        KKASSERT(bp->b_bio1.bio_done == NULL);
        vfs_busy_pages(bp->b_vp, bp);