From patchwork Mon Jul 8 00:50:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 1128792 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45hn2k1vwDz9sNC; Mon, 8 Jul 2019 10:51:42 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1hkHsX-0002Xk-Hv; Mon, 08 Jul 2019 00:51:37 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1hkHsV-0002W8-1Z for kernel-team@lists.ubuntu.com; Mon, 08 Jul 2019 00:51:35 +0000 Received: from mail-qt1-f197.google.com ([209.85.160.197]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1hkHsU-0004dL-DX for kernel-team@lists.ubuntu.com; Mon, 08 Jul 2019 00:51:34 +0000 Received: by mail-qt1-f197.google.com with SMTP id l9so8338736qtu.12 for ; Sun, 07 Jul 2019 17:51:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=8rtEYWNZEMUCVF8mPWSReKnD47I1qQCqEg/FTroz8Xs=; b=s1LcSa2f6HKSG6g1O0YmYpWPiPZfpeYNXJUwy4N0ALCOEYUXDtej8djo0BWr27PRIa w3x7BdUjWU2sElhGNOEDrS1v8fHCcZOby8hkUwTXiuLx/2TzbpaFJ5mhZzD1oWBHLq+D /JMt4ePfImA5SToKvfrUF5Z81E9UeGt2tVDqPKFpL0+uXTqxpE8Xi6CX0hYfXcQyrM/c gowEWXM4h/lroI060HiiiVyEJM9qmVBrcDqB1vyt2M4akyHVEMT+uaw2orkUC34HyuPJ 2BSOVznZbBkXuIwCn4zaHGvUGKl1rArwo0GF745E39oIFafWmMjzD4/Wx/OyK9imoELi S2HQ== X-Gm-Message-State: APjAAAVqYOaKZBmThF1GvL0S5aLPKTtxky7Y7AQVYGp5t87OVvUs/X1P ySOFg+4UW+I0wJv1spY6kZL3u7dhiVw32x8Dc8M6osk47PdeoPdYi6Z33sV8mYwDDwyDrb6dFqf Cg4LXY6bMAwDbxDQ4pXfNyWd1sYisQL4A8k3XXaLhBQ== X-Received: by 2002:a0c:d604:: with SMTP id c4mr12463957qvj.27.1562547093535; Sun, 07 Jul 2019 17:51:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzMrZ5PK/YPw4gmzn8I/kAt5Ise9PQ2TmuNjknQc3OkZoP3NMJUg3qA3HJf/qO3j+tX73SRPQ== X-Received: by 2002:a0c:d604:: with SMTP id c4mr12463948qvj.27.1562547093353; Sun, 07 Jul 2019 17:51:33 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:4e7:1017:3da7:3d04:ea25:3a0]) by smtp.gmail.com with ESMTPSA id t197sm6697527qke.2.2019.07.07.17.51.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 07 Jul 2019 17:51:33 -0700 (PDT) From: Mauricio Faria de Oliveira To: kernel-team@lists.ubuntu.com Subject: [B][PATCH 07/11] bcache: count backing device I/O error for writeback I/O Date: Sun, 7 Jul 2019 21:50:34 -0300 Message-Id: <20190708005038.13184-8-mfo@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190708005038.13184-1-mfo@canonical.com> References: <20190708005038.13184-1-mfo@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Coly Li BugLink: https://bugs.launchpad.net/bugs/1829563 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 Reviewed-by: Hannes Reinecke Signed-off-by: Jens Axboe (cherry picked from commit bf78980fcc58bad2d61858ce342153a3dd097aa0) Signed-off-by: Mauricio Faria de Oliveira --- 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 8ee82acf2c3a..993dcc5cd97a 100644 --- a/drivers/md/bcache/writeback.c +++ b/drivers/md/bcache/writeback.c @@ -220,8 +220,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); }