Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2108727lkv; Thu, 20 May 2021 03:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKEakHlYoT9g7rOScTOdon+BWPQKThrGm9wMqOlG/DkB3kjerWl5wzt9u0nEntPG2CnPio X-Received: by 2002:a02:5d44:: with SMTP id w65mr5150014jaa.15.1621507016505; Thu, 20 May 2021 03:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621507016; cv=none; d=google.com; s=arc-20160816; b=TKyBw3rrjAZNJ85uHTvbz1mNQQvrG0MHDLb+vSeQ9nxztRXnKi9Ro9pgw+o+skFfNV +sAuGjwqUNn6A7GZMHCazHoX6cD7AiDc+etk+2pUZ7wlog+7gFdTLiYtw/AzUVBJR58x HaL/8JUMA05ReZptIAJfY0vqDL72KvGlN/d2h991Emur5Q6Xl/dryn/Dppc2HToYQXEh JO1B+M8zjIUO6ng84GU/JaTuV3FuisfaEO1x4IWejfo3RU3ITI2cWCNIc7w1AvV0w53R HrJuWVFLYrqLDvWI5PWWwxJfKHH9mjU2Qmuku3YKi5OONOpp95He35LKWfi0RdY3r9bU Dmzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G9dlkCQrEcK7w6JoYB2oQn4aQliMNip5yioLh+skgyE=; b=s2h2ttmT98JyojO12a6SiKEaxYEaIJfdUcahzS1T5H/Rt+r97Bt/qULB/VXxxeTfVe 0gM3bvjqoqQA5Py2Q3v3darONJ6iV/SPdxoS/17Nb1J90yhaEECKTTnQbfo8axAEMyPY HZUh1RRDpt2pw3LrmZXn1hn3oN4h2CWgp7+ihcpL1y3FQC07Z3qgbp5sAAx5/wb40jsx nwG3xKUk33osMMxI/pGVtGvDIcQ3R6cKcrpYTvspF+XYyBFHHdXo5QjnhIN9ScgArUh/ pJKgqfeDzA58TAQmJM6BrCeA+SyNoaPejB3juav0lQJy2Bh3Rz5NQ3kEMwnHpjl9O1T7 1lNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WgMVjji2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si1923523jav.104.2021.05.20.03.36.44; Thu, 20 May 2021 03:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WgMVjji2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237710AbhETKfV (ORCPT + 99 others); Thu, 20 May 2021 06:35:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:53182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236011AbhETKVi (ORCPT ); Thu, 20 May 2021 06:21:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0EF81613F5; Thu, 20 May 2021 09:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504087; bh=rKrYEiyiX5DnnR1jU76RXfMmDXDAHeJ8joBUQjKDehg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgMVjji24Mz19dmI65GtEiEK25VXKp5GoUXvTBfabOCFlwdpifQ1sGs60y8LFfAkE ctPzpEHuxwNav6lsDar1bp9KXPptVxvkm858X6xmUK4IISEvUtV8lZkTB11uqTJhPC 4YQ52VGvptEQ6ZsDDQT3eWCTwy0a+Uuc0Fm6URuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Clements , Song Liu Subject: [PATCH 4.14 085/323] md/raid1: properly indicate failure when ending a failed write request Date: Thu, 20 May 2021 11:19:37 +0200 Message-Id: <20210520092122.999226631@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Clements commit 2417b9869b81882ab90fd5ed1081a1cb2d4db1dd upstream. This patch addresses a data corruption bug in raid1 arrays using bitmaps. Without this fix, the bitmap bits for the failed I/O end up being cleared. Since we are in the failure leg of raid1_end_write_request, the request either needs to be retried (R1BIO_WriteError) or failed (R1BIO_Degraded). Fixes: eeba6809d8d5 ("md/raid1: end bio when the device faulty") Cc: stable@vger.kernel.org # v5.2+ Signed-off-by: Paul Clements Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid1.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -446,6 +446,8 @@ static void raid1_end_write_request(stru if (!test_bit(Faulty, &rdev->flags)) set_bit(R1BIO_WriteError, &r1_bio->state); else { + /* Fail the request */ + set_bit(R1BIO_Degraded, &r1_bio->state); /* Finished with this branch */ r1_bio->bios[mirror] = NULL; to_put = bio;