Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp766165ybn; Tue, 24 Sep 2019 09:10:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgeEgZMlUb+GWerOSaIdDK+qre2HspsedPffw6TdJz5akFnuNcl0wJmWogSQyd4sEvp94g X-Received: by 2002:a17:906:49c7:: with SMTP id w7mr3298101ejv.167.1569341423591; Tue, 24 Sep 2019 09:10:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569341423; cv=none; d=google.com; s=arc-20160816; b=cJOgMkM+88PTABWJlh3slVNDeSdtmoLncaJ5Jtp23k1e/VJ9MR+wsVhSSPBYDtMGh+ rz9/VkFxY0KyaI08IVTSSewYCaF/+Q1rDibBd6Mher33v2eLeqI7TwdcqVyMNSNqY5xD yMcWqeoJ+Ul8KrSeO13ubwqITWwctdhpE3edY6zuVDJWrYQhRwSxVWC+mOJ7Nsqpjl3m 91uFKFExNeThRrTaTvw4aCJ0GCXJYRLHwQk56k2iOh66ELt3dYYHQGPRrCmIstBcLr8L CUA69Nii7j0FITUMBcbax6vI/CREjtF4gZxe54Lgj5q4cVKrUjwmnz28A9yolQolj6oE d3aw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+Sn2LwJkou33CK/6SoCI1XYVVQUJWburl501S1XPTbA=; b=yatk9MhFj9/IWIoR2jjN1vlh83YN/KSGLyaEyWV9LiIHb3e339AjxEMAR6aD+N+Z/d kRg/SlK9VOKZ2oeTGyWGcno0PsvKUaAW3Qsq8dK6lsYAx2L6ptRf/nSWwPGpsnRembbz 3Xxl0qA+Kx4itwPVjtZ61/D4tAd1F5Hk4n62SCC0CNXbL+nYaq3ya+n5bkfjrGjKNR3J oxv8sNVWdduI5Z/K0uNepklH3Jl4fodzyyEc0aMPw1UDpph2dyNhu8dht3mUI5Yw9Jda jI7RlApCpFMVNp4NfRJrU3f31FLr/XbEv3ohO9o9tR3PVeGYG7ds+JJ+ny3nfnl1p4SV mi0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=meLW7Odh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p8si1135374ejf.58.2019.09.24.09.09.58; Tue, 24 Sep 2019 09:10:23 -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=meLW7Odh; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406806AbfIVThn (ORCPT + 99 others); Sun, 22 Sep 2019 15:37:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:41416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389541AbfIVSpm (ORCPT ); Sun, 22 Sep 2019 14:45:42 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 08FEE222C2; Sun, 22 Sep 2019 18:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569177941; bh=wHCe2eLqeBayLHrTaC81ulGiWcK3ZH12sxzE0bgkK5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=meLW7Odhl6RqRgZk2CrTSO1dBjADj/TKyMDGeka5XDUVmLZd8mdvz0XtMUrJwJEHT +krwcrhebrjJ12dA8apB6nka62liAeUVmoUWgP5mmqc8H9C98HW9Ry4Qd4NEq/XPjW JMFyeujDWj6aU3aoYPpU81N3Xc8Mwpk7M/x/SWnc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yufen Yu , Song Liu , Sasha Levin , linux-raid@vger.kernel.org Subject: [PATCH AUTOSEL 5.3 050/203] md/raid1: end bio when the device faulty Date: Sun, 22 Sep 2019 14:41:16 -0400 Message-Id: <20190922184350.30563-50-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yufen Yu [ Upstream commit eeba6809d8d58908b5ed1b5ceb5fcb09a98a7cad ] When write bio return error, it would be added to conf->retry_list and wait for raid1d thread to retry write and acknowledge badblocks. In narrow_write_error(), the error bio will be split in the unit of badblock shift (such as one sector) and raid1d thread issues them one by one. Until all of the splited bio has finished, raid1d thread can go on processing other things, which is time consuming. But, there is a scene for error handling that is not necessary. When the device has been set faulty, flush_bio_list() may end bios in pending_bio_list with error status. Since these bios has not been issued to the device actually, error handlding to retry write and acknowledge badblocks make no sense. Even without that scene, when the device is faulty, badblocks info can not be written out to the device. Thus, we also no need to handle the error IO. Signed-off-by: Yufen Yu Signed-off-by: Song Liu Signed-off-by: Sasha Levin --- drivers/md/raid1.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 34e26834ad28b..501a3b4d82f33 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -447,19 +447,21 @@ static void raid1_end_write_request(struct bio *bio) /* We never try FailFast to WriteMostly devices */ !test_bit(WriteMostly, &rdev->flags)) { md_error(r1_bio->mddev, rdev); - if (!test_bit(Faulty, &rdev->flags)) - /* This is the only remaining device, - * We need to retry the write without - * FailFast - */ - set_bit(R1BIO_WriteError, &r1_bio->state); - else { - /* Finished with this branch */ - r1_bio->bios[mirror] = NULL; - to_put = bio; - } - } else + } + + /* + * When the device is faulty, it is not necessary to + * handle write error. + * For failfast, this is the only remaining device, + * We need to retry the write without FailFast. + */ + if (!test_bit(Faulty, &rdev->flags)) set_bit(R1BIO_WriteError, &r1_bio->state); + else { + /* Finished with this branch */ + r1_bio->bios[mirror] = NULL; + to_put = bio; + } } else { /* * Set R1BIO_Uptodate in our master bio, so that we -- 2.20.1