Rather than not redirting the bp when we get ENXIO, only redirty it

when the error is EIO.  This catches a much larger class of errors
that are unlikely to succeed if retried.

Submitted by: bde
This commit is contained in:
imp 2007-12-30 05:53:45 +00:00
parent 2b8395148f
commit 95c2febd5a

View File

@ -1168,19 +1168,13 @@ brelse(struct buf *bp)
return;
}
if (bp->b_iocmd == BIO_WRITE &&
(bp->b_ioflags & BIO_ERROR) &&
bp->b_error != ENXIO &&
!(bp->b_flags & B_INVAL)) {
if (bp->b_iocmd == BIO_WRITE && (bp->b_ioflags & BIO_ERROR) &&
bp->b_error == EIO && !(bp->b_flags & B_INVAL)) {
/*
* Failed write, redirty. Must clear BIO_ERROR to prevent
* pages from being scrapped. If B_INVAL is set then
* this case is not run and the next case is run to
* destroy the buffer. B_INVAL can occur if the buffer
* is outside the range supported by the underlying device.
* If the error is that the device went away (ENXIO), we
* shouldn't redirty the buffer either, but discard the
* data too.
* pages from being scrapped. If the error is anything
* other than an I/O error (EIO), assume that retryingi
* is futile.
*/
bp->b_ioflags &= ~BIO_ERROR;
bdirty(bp);