Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9980876ybi; Wed, 24 Jul 2019 13:28:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqyl/Mp1O0jOdF3/Xb1/TOpZA2ddbSp9QW8SbrPh5PkVoxqI21ohX42gvkTasXS4icE2zTZ6 X-Received: by 2002:a17:902:a606:: with SMTP id u6mr81206746plq.275.1564000120954; Wed, 24 Jul 2019 13:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564000120; cv=none; d=google.com; s=arc-20160816; b=F7buIkYhDzn/OtQLKjhYzE2kdTAOq7ZJ70ZhSP5dsO24W3ISHk0ikQQvZu/x5/0m0+ wp983Llp9cpl5YZAOSMmgOGVR2w2vsdYrkLIPO1aMkrbmqMhAcbaVt9ODDS5w/J5rchG AgEbe1bnXC1NxdEdzqqvWz//GDffwn9EDf80xW/fkS799zccRiRi44fyaOVk8jqEJOC0 UQzOcvpe0Zxvww6DZuyovStQkv7PD5W4KqOCi65G+4eTslmeUcLIkizMAP7S5BNnPyI8 vevvTuyTbNJPvUexJPCG7H8mpb6D+EpmtnHnZXJjKF8B2fmLl6Qlwo+0jbMwCHzPqxmA I8rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=GBCGNL0nU/gLZun9CxCcMYNTRv7RMVeujnoq6DKvdn0=; b=y/3m+hTo0UXMnvQ+1kxh0TSOkqvcRvRrXiJPNG38kXBgTAE0R3ole60tI6FKUBcPAF BnIr9tlQAl1XbOXczeyp1g4AuIpt/Cuy87zou92nakWOiBgNYkzLm0RGQRw3S8xUpMpE EbuOCiFOTSUxG4QHNHN2ClmQaB3hP5ESWR0poll87yeZlLQLDk7cFNL/Y6j3e3+u1nUF qjBPxVZY0LjhSnhYYtZbswl6Ue/G5gayO2OB9W7iX/TT4jWSUQVG7MIJhMC9c6YJNOYl 0fbiqc9s3Vz8WiugMITgIf+VD83uHtR3waOq8dqEbWQJkN/eA1110Hxib5j4DU7zi5FA W7Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ai1GDACE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si20338381pfb.132.2019.07.24.13.28.26; Wed, 24 Jul 2019 13:28:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ai1GDACE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728034AbfGXTga (ORCPT + 99 others); Wed, 24 Jul 2019 15:36:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:36178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728862AbfGXTg1 (ORCPT ); Wed, 24 Jul 2019 15:36:27 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 75233214AF; Wed, 24 Jul 2019 19:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563996985; bh=QtlBSosPIGx7NyC+f4ToTQU3coh+S8xMK3YXpkL+5Qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ai1GDACEmAx6ec58xfA+mwxeUSUZNIJaSIFC2/wYxBQpAp7JtMxIojn0816x1cy95 3RaupP4GtktfP8/fzyJ4Wm+XctwJPv1irBRMqhN3nYBVmAMHEXsvAtWWjErTmYxjzL uZh0C6wnxkqxLMeReA3JmmmPJexJYond9OwDqwOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Coly Li , Jens Axboe , Thorsten Knabe Subject: [PATCH 5.2 283/413] bcache: ignore read-ahead request failure on backing device Date: Wed, 24 Jul 2019 21:19:34 +0200 Message-Id: <20190724191756.533969744@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Coly Li commit 578df99b1b0531d19af956530fe4da63d01a1604 upstream. When md raid device (e.g. raid456) is used as backing device, read-ahead requests on a degrading and recovering md raid device might be failured immediately by md raid code, but indeed this md raid array can still be read or write for normal I/O requests. Therefore such failed read-ahead request are not real hardware failure. Further more, after degrading and recovering accomplished, read-ahead requests will be handled by md raid array again. For such condition, I/O failures of read-ahead requests don't indicate real health status (because normal I/O still be served), they should not be counted into I/O error counter dc->io_errors. Since there is no simple way to detect whether the backing divice is a md raid device, this patch simply ignores I/O failures for read-ahead bios on backing device, to avoid bogus backing device failure on a degrading md raid array. Suggested-and-tested-by: Thorsten Knabe Signed-off-by: Coly Li Cc: stable@vger.kernel.org Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/md/bcache/io.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/drivers/md/bcache/io.c +++ b/drivers/md/bcache/io.c @@ -58,6 +58,18 @@ void bch_count_backing_io_errors(struct WARN_ONCE(!dc, "NULL pointer of struct cached_dev"); + /* + * Read-ahead requests on a degrading and recovering md raid + * (e.g. raid6) device might be failured immediately by md + * raid code, which is not a real hardware media failure. So + * we shouldn't count failed REQ_RAHEAD bio to dc->io_errors. + */ + if (bio->bi_opf & REQ_RAHEAD) { + pr_warn_ratelimited("%s: Read-ahead I/O failed on backing device, ignore", + dc->backing_dev_name); + return; + } + errors = atomic_add_return(1, &dc->io_errors); if (errors < dc->error_limit) pr_err("%s: IO error on backing device, unrecoverable",