Received: by 2002:a25:730a:0:0:0:0:0 with SMTP id o10csp596207ybc; Thu, 3 Oct 2019 09:19:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzGJQWZq4026Ix7ayoDp1tFwv6bwzNh4UcQKC4blzi9xs+A5Mw3h7RhGy+1f2tp/FP/d+Gp X-Received: by 2002:a50:f00c:: with SMTP id r12mr10534037edl.274.1570119542707; Thu, 03 Oct 2019 09:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570119542; cv=none; d=google.com; s=arc-20160816; b=I5RcQkzem0nkShSOnhWpCfT6EksiKNyAcavemkOFGe+Oczv0k4IdQ7z1iUemgASgDR Jvn8I+QHkbZnfukvb8LFul2Pd91yldj20D/0MoJkSisZp3qkLzmY6F8Q9mSmV5TuXu6u Cqs7e5qdi1ZPhR5Dc1jKO9SRMFFPFCJeCxcx31DMgFRE/UoOPoqqO90UseLNqNsAeYPC k5uoigd6Y+I32Uq9sQrsKBZ8chz5Sj37tFnEaWtkvhlYK01jSge++YrkmiAz10y9Kscy U+fOK+ZBuFwaBbHnHq0fEgmriDfCV7zPja40toNz6d+s9T/JCslCPAIfZBtfFy3dKWiL 52AA== 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=zXjXMq9OZEHak20Mg8nR9VYzPWtfomgIbA6cgPIYwNw=; b=yiiWwIYshHnK8WGGL3FahEqam0d2ykV4Yx3bePYaeSNYZFkmbgrmXWeL2zWBHPYGkk XbCLzpfKdypf/ya+u/D7VIYUWlahcS4y1/I6vma48w2SY8UXcE9aNrCRxE5Egy32FvND dqFASewGvte2kYLJhTz4QaW7y6EDsp0zFS+wuPQ2x1+eBJpPq1UJM+oJMWqjOg3C3fh4 gKxTDWRwPafg2KQA5cVrsZ3tO6bhMCAFEvjFL2/e/XJC7fI3Nybt/nQ9gsKa+wao28AU Szz8ALCADw7BkFxMXu36xX91FSWWxy2cl8IBtZpzBuLmHjdk7w3YRMZtEXVzC6fhac41 d+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Q6X5YLaL; 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 d8si1423050ejt.206.2019.10.03.09.18.38; Thu, 03 Oct 2019 09:19:02 -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=Q6X5YLaL; 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 S2389109AbfJCQQx (ORCPT + 99 others); Thu, 3 Oct 2019 12:16:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:42138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389086AbfJCQQt (ORCPT ); Thu, 3 Oct 2019 12:16:49 -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 23DD720700; Thu, 3 Oct 2019 16:16:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570119408; bh=XdCheeG0w24WQDvOmQTlTAsMqd8i15E+HQEqz4HkuCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6X5YLaLa/W6TaXnUjCOxmGprFGDFR+K/5cHi+ejmmcsWG/VZBeOAQXVPNI+5o1dm CJzKytyIURNoZCFAthZaYSzT29DcZzFWdNAl6HAl6KAjA7w/cR37xf3ltCZ5AfTfbF +E2KR/QYYpFow+jnuP+W2wHUTlL6saQ6d9QLOyvc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yufen Yu , Song Liu , Sasha Levin Subject: [PATCH 4.19 054/211] md/raid1: end bio when the device faulty Date: Thu, 3 Oct 2019 17:52:00 +0200 Message-Id: <20191003154500.482539522@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191003154447.010950442@linuxfoundation.org> References: <20191003154447.010950442@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: 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 fa47249fa3e42..54010675df9a5 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -434,19 +434,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