Received: by 10.213.65.68 with SMTP id h4csp1792519imn; Mon, 19 Mar 2018 13:24:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELsYy//ZtJdOrT0cmnpW/5cJ8xQTq3w70mU2B9E1ILABvns1we5vH9fzKl898cKh2qH/o8tf X-Received: by 10.167.131.86 with SMTP id z22mr11328584pfm.185.1521491050365; Mon, 19 Mar 2018 13:24:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521491050; cv=none; d=google.com; s=arc-20160816; b=Cu4zE4Ug7TN/ob823NISBVUrDdDnJuiR8zvH0oCsMUGj536OUAprvgirY8+fS3bxew 7P+mVo4BBls9iVPPTe7w2LIMu8sjOloI9z0E2CrHh0njoGqq8HCsxVD6i4g6kf/fbkxh eIoX6ljFJKHKM5PHv1W4EbD/V1pfC77NkyVkVLAN12SrZxiVLwludVk0TPvkfPzYLGk7 80LBc78PBdz4U61CmgViElA+S5rBk9T8DckDROohHTjemWkTCNpsZGoDqSxmTbnG5+3y Kmz/Wxxg8JcyLz+SR+I4h0FR6TyDgFqP8hUe8squtKydBtOvFWcP5WoDzcweGLMTWRpS hFDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=3QxlR4l+fs8jWBAq6Mz+tvfTpmV93wv2pkT0l2gnoJE=; b=1KkufDF8PUpbIU6qva5FWEibnPBkdFl2riAxR2MbEZIPOsbM5IkiQfhbdsjI6+pXkj seHpkTx1cjzLBuzZjetdEbOsGjN8+G8dEJ8ImAtROf3Vxh5vnh9sT8DdqLQ3VMeZ7apj sOnj+DPzLXrNO/NHtuWRUaW/Szi+ZOOQcWnt3/Ce22EmzK1hNlY5XVLUgyHd6lKEkX08 Z+3gdk6F6PgwytC1bIpJfhBv0Aqjg09uO2KGfox5hmbI+ZQVuJsBu+7JHO0sMZzUeAEL sA9jKRHbQsttPLwzkI8q/lcElQaUPLQela/eIDtZGgGVicfcpLBOlHwytNURXyaCKPTX BTzw== ARC-Authentication-Results: i=1; mx.google.com; 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 p7si12829pgs.203.2018.03.19.13.23.55; Mon, 19 Mar 2018 13:24:10 -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; 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 S1030715AbeCSSOx (ORCPT + 99 others); Mon, 19 Mar 2018 14:14:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44316 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030698AbeCSSOs (ORCPT ); Mon, 19 Mar 2018 14:14:48 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 67315F58; Mon, 19 Mar 2018 18:14:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Williams , NeilBrown , Shaohua Li , Sasha Levin Subject: [PATCH 4.4 067/134] md/raid6: Fix anomily when recovering a single device in RAID6. Date: Mon, 19 Mar 2018 19:05:50 +0100 Message-Id: <20180319171858.945193883@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319171849.024066323@linuxfoundation.org> References: <20180319171849.024066323@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: NeilBrown [ Upstream commit 7471fb77ce4dc4cb81291189947fcdf621a97987 ] When recoverying a single missing/failed device in a RAID6, those stripes where the Q block is on the missing device are handled a bit differently. In these cases it is easy to check that the P block is correct, so we do. This results in the P block be destroy. Consequently the P block needs to be read a second time in order to compute Q. This causes lots of seeks and hurts performance. It shouldn't be necessary to re-read P as it can be computed from the DATA. But we only compute blocks on missing devices, since c337869d9501 ("md: do not compute parity unless it is on a failed drive"). So relax the change made in that commit to allow computing of the P block in a RAID6 which it is the only missing that block. This makes RAID6 recovery run much faster as the disk just "before" the recovering device is no longer seeking back-and-forth. Reported-by-tested-by: Brad Campbell Reviewed-by: Dan Williams Signed-off-by: NeilBrown Signed-off-by: Shaohua Li Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/md/raid5.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3372,9 +3372,20 @@ static int fetch_block(struct stripe_hea BUG_ON(test_bit(R5_Wantcompute, &dev->flags)); BUG_ON(test_bit(R5_Wantread, &dev->flags)); BUG_ON(sh->batch_head); + + /* + * In the raid6 case if the only non-uptodate disk is P + * then we already trusted P to compute the other failed + * drives. It is safe to compute rather than re-read P. + * In other cases we only compute blocks from failed + * devices, otherwise check/repair might fail to detect + * a real inconsistency. + */ + if ((s->uptodate == disks - 1) && + ((sh->qd_idx >= 0 && sh->pd_idx == disk_idx) || (s->failed && (disk_idx == s->failed_num[0] || - disk_idx == s->failed_num[1]))) { + disk_idx == s->failed_num[1])))) { /* have disk failed, and we're requested to fetch it; * do compute it */