Skip to content

Commit

Permalink
bcache: count backing device I/O error for writeback I/O
Browse files Browse the repository at this point in the history
Commit c7b7bd0 ("bcache: add io_disable to struct cached_dev")
counts backing device I/O requets and set dc->io_disable to true if error
counters exceeds dc->io_error_limit. But it only counts I/O errors for
regular I/O request, neglects errors of write back I/Os when backing device
is offline.

This patch counts the errors of writeback I/Os, in dirty_endio() if
bio->bi_status is  not 0, it means error happens when writing dirty keys
to backing device, then bch_count_backing_io_errors() is called.

By this fix, even there is no reqular I/O request coming, if writeback I/O
errors exceed dc->io_error_limit, the bcache device may still be stopped
for the broken backing device.

Fixes: c7b7bd0 ("bcache: add io_disable to struct cached_dev")
Signed-off-by: Coly Li <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Coly Li authored and axboe committed May 3, 2018
1 parent 6147305 commit bf78980
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/md/bcache/writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,10 @@ static void dirty_endio(struct bio *bio)
struct keybuf_key *w = bio->bi_private;
struct dirty_io *io = w->private;

if (bio->bi_status)
if (bio->bi_status) {
SET_KEY_DIRTY(&w->key, false);
bch_count_backing_io_errors(io->dc, bio);
}

closure_put(&io->cl);
}
Expand Down

0 comments on commit bf78980

Please sign in to comment.