All of lore.kernel.org
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: linux-bcache@vger.kernel.org
Cc: linux-block@vger.kernel.org, Coly Li <colyli@suse.de>
Subject: [PATCH 3/6] bcache: count backing device I/O error for writeback I/O
Date: Tue, 24 Apr 2018 20:14:43 +0800	[thread overview]
Message-ID: <20180424121446.130552-4-colyli@suse.de> (raw)
In-Reply-To: <20180424121446.130552-1-colyli@suse.de>

Commit c7b7bd07404c5 ("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: c7b7bd07404c5 ("bcache: add io_disable to struct cached_dev")
Signed-off-by: Coly Li <colyli@suse.de>
---
 drivers/md/bcache/writeback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/bcache/writeback.c b/drivers/md/bcache/writeback.c
index 4a9547cdcdc5..ad45ebe1a74b 100644
--- a/drivers/md/bcache/writeback.c
+++ b/drivers/md/bcache/writeback.c
@@ -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);
 }
-- 
2.16.2

  parent reply	other threads:[~2018-04-24 12:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-24 12:14 [PATCH 0/6] bcache fixes for device failure handling Coly Li
2018-04-24 12:14 ` [PATCH 1/6] bcache: store disk name in struct cache and struct cached_dev Coly Li
2018-04-24 12:14 ` [PATCH 2/6] bcache: set CACHE_SET_IO_DISABLE in bch_cached_dev_error() Coly Li
2018-04-24 12:14 ` Coly Li [this message]
2018-04-24 12:14 ` [PATCH 4/6] bcache: add wait_for_kthread_stop() in bch_allocator_thread() Coly Li
2018-04-24 12:14 ` [PATCH 5/6] bcache: set dc->io_disable to true in conditional_stop_bcache_device() Coly Li
2018-04-24 12:14 ` [PATCH 6/6] bcache: use pr_info() to inform duplicated CACHE_SET_IO_DISABLE set Coly Li
2018-04-30  6:24 ` [PATCH 0/6] bcache fixes for device failure handling Coly Li
2018-05-02 14:46 [PATCH v2 0/6] bcache device failure handling fixes for 4.17-rc4 Coly Li
2018-05-02 14:46 ` [PATCH 3/6] bcache: count backing device I/O error for writeback I/O Coly Li
2018-05-03  5:53   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180424121446.130552-4-colyli@suse.de \
    --to=colyli@suse.de \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.