Received: by 10.192.165.148 with SMTP id m20csp558138imm; Wed, 2 May 2018 05:13:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr90i3u5xyhdhv8f6vL7OOcIQ7PVkVdszQGyG4rnvRqVnveYm/TuVYFytR/+SiF0XPPVndW X-Received: by 2002:a63:a901:: with SMTP id u1-v6mr16446744pge.251.1525263203430; Wed, 02 May 2018 05:13:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525263203; cv=none; d=google.com; s=arc-20160816; b=ka8FVvpRcwl2Az1RNzWljP1VRICom6cBlRule7lNv/jSbPN10aI4dyaV4g2xdmfS7g HHqDQj3FCnDcxYrW0vlSZ8TA+h2WBna8y3axJUZLNi1AowOVxRc/J3OTE2r1Y2uin02c sVyQYhH2F36CILpi9qkqeEHBQGh8KSOc0GA6d6AB8CTJ0FFq/TFjxGo8C1KEAOlSPX75 n7I/5A9RfDgkNYjwrIxOkxzo5Ri4Im0CqiMjkYZzbdi6EVy4tcWzoeL4cRrkSbi5l0oZ W1VFUri9vfg0GactLzvCgdy8KiNujUd1R/E9dXTXeAhZ2z/si6cgAHgLp6rK7PVUSmsC qFyw== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=fACedIrMwp5Hcy6xKQP1pGg5yYBt8HFKF4y+IL8rFQ4=; b=VcSQ3N5DFKO4bK0jJPCH8Uyce1RoiZeAEm0PNhlJdc6h12AHItxZ67L7wMAxhndU7j uxmEYAaurqjefADYlJggUSOLQDujvCP/XrfV8VWjbc7x9s6rCV3CMifkk7blA2SSZ1kF vO1pPfQ+h34vrIviyoqNU5/4quXwNx8crKtK1sIcMnB/w7724TtyCV0VnlZq9t7J8TBm tNF/u2lxNrALMvFAHWPuxypbwa+2HB6SVyaJIQhYIUsIvctgJcHUY46TassLcw4yMClI yjQC4F9CvlgaCYRPts2CqHCHqothzp0yvK234mrMGe/aNAuIRB0KFQ3+cfsYgnZEiwut rC/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@profitbricks-com.20150623.gappssmtp.com header.s=20150623 header.b=1Cwc+QhJ; 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 j63-v6si9171892pgc.474.2018.05.02.05.13.09; Wed, 02 May 2018 05:13: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=@profitbricks-com.20150623.gappssmtp.com header.s=20150623 header.b=1Cwc+QhJ; 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 S1751310AbeEBMMe (ORCPT + 99 others); Wed, 2 May 2018 08:12:34 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36305 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750930AbeEBMMb (ORCPT ); Wed, 2 May 2018 08:12:31 -0400 Received: by mail-wm0-f52.google.com with SMTP id n10so23878345wmc.1 for ; Wed, 02 May 2018 05:12:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=profitbricks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=fACedIrMwp5Hcy6xKQP1pGg5yYBt8HFKF4y+IL8rFQ4=; b=1Cwc+QhJv4ntINDdZXgp72QcyOVGA+ypxEHHA6IKxzdva76tjKSK3Vadulr0tKWKIJ d9zkogRmGlVm+rkUEyYQ/cjgpLX1dXpSteLXrzRvsCGhN/cydbZ1cOwAMnez7joPCnKf FtrmvLEuuWUV0+gavZclIFqUnv1PM3LNJH7IwLJM2TgIS+JnnIDuBkzIoDHskQimlFD4 Abm01Q8hofvMe+Gdcs7uOsZGoRuYkM/+Rz1qVKb+B5wVucfqe0nvhtdatuMUzf0xMb62 owLnrLf8ZCov73ererWNl7c3UyJlAfDYNB9yHulK3p7IGlcYCUJFzwrzngAuqyUoRsH2 xm4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=fACedIrMwp5Hcy6xKQP1pGg5yYBt8HFKF4y+IL8rFQ4=; b=SQtSlscVpglDR7sAGzZ8BYCIqQ6qyKkuFV4dIGYcjrAYn/V/eC0Sspl/6oHEEAvKBQ JEvarpL7maHevenEVFeKSWPddNTSeceQ+zW2KvB5FArzNjt2ZhCXHgq44JDEumWpXi8C +f8dhLjau2ml4v/oGeeXdsHiDmByd4JrrtGpr709L5hls+13gVWvkcZDhzo/hbh4/+7E fjMx8leepMK+vgGQJLTLh7I8k23mKJuWSC4j8+4zz6kFXYIv/YYFsDsGbiSj4950yRS/ mGjW8aJfnqBt0qX4cGc/nTkR42JF89wGAa0oZscrPWRpXCr7s66/gbo5FBV9prX+B0wb vAlQ== X-Gm-Message-State: ALQs6tDg4PFij6619PGWPlZp/an+QiXmKAgaz5n/es7cD4NcOXXwXsc5 mSGZHozJGO+tpeNrmJoAOhODIzWRV3rBCqK9RU3LgQ== X-Received: by 2002:aa7:d34e:: with SMTP id m14-v6mr25668147edr.108.1525263149863; Wed, 02 May 2018 05:12:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.219.6 with HTTP; Wed, 2 May 2018 05:11:49 -0700 (PDT) In-Reply-To: <20180502110811.10886-1-gi-oh.kim@profitbricks.com> References: <20180502110811.10886-1-gi-oh.kim@profitbricks.com> From: Gi-Oh Kim Date: Wed, 2 May 2018 14:11:49 +0200 Message-ID: Subject: Re: [PATCH] md/raid1: add error handling of read error from FailFast device To: shli@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, Gioh Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 2, 2018 at 1:08 PM, Gioh Kim wrote= : > Current handle_read_error() function calls fix_read_error() > only if md device is RW and rdev does not include FailFast flag. > It does not handle a read error from a RW device including > FailFast flag. > > I am not sure it is intended. But I found that write IO error > sets rdev faulty. The md module should handle the read IO error and > write IO error equally. So I think read IO error should set rdev faulty. > > Signed-off-by: Gioh Kim > --- > drivers/md/raid1.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > index e9e3308cb0a7..4445179aa4c8 100644 > --- a/drivers/md/raid1.c > +++ b/drivers/md/raid1.c > @@ -2474,6 +2474,8 @@ static void handle_read_error(struct r1conf *conf, = struct r1bio *r1_bio) > fix_read_error(conf, r1_bio->read_disk, > r1_bio->sector, r1_bio->sectors); > unfreeze_array(conf); > + } else if (mddev->ro =3D=3D 0 && test_bit(FailFast, &rdev->flags)= ) { > + md_error(mddev, rdev); > } else { > r1_bio->bios[r1_bio->read_disk] =3D IO_BLOCKED; > } > -- > 2.14.1 > I think it would be helpful to show how I tested it. As following I used Ubuntu 17.10 and mdadm v4.0. # cat /etc/lsb-release DISTRIB_ID=3DUbuntu DISTRIB_RELEASE=3D17.10 DISTRIB_CODENAME=3Dartful DISTRIB_DESCRIPTION=3D"Ubuntu 17.10" # uname -a Linux ws00837 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux # mdadm --version mdadm - v4.0 - 2017-01-09 Following is how I generated the read IO error and checked md device. After read IO, no device was set as faulty # modprobe scsi_debug num_parts=3D2 # man mdadm # mdadm -C /dev/md111 --failfast -l 1 -n 2 /dev/sdc1 /dev/sdc2 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=3D0.90 mdadm: largest drive (/dev/sdc2) exceeds size (3904K) by more than 1% Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md111 started. # mdadm -D /dev/md111 /dev/md111: Version : 1.2 Creation Time : Wed May 2 10:55:35 2018 Raid Level : raid1 Array Size : 3904 Used Dev Size : 3904 Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Wed May 2 10:55:36 2018 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Name : ws00837:111 (local to host ws00837) UUID : 9f214193:03cf7c97:3208da22:d6ab8a13 Events : 17 Number Major Minor RaidDevice State 0 8 33 0 active sync failfast /dev/sdc1 1 8 34 1 active sync failfast /dev/sdc2 # cat /proc/mdstat Personalities : [raid1] md111 : active raid1 sdc2[1] sdc1[0] 3904 blocks super 1.2 [2/2] [UU] unused devices: # echo -1 > /sys/module/scsi_debug/parameters/every_nth && echo 4 > /sys/module/scsi_debug/parameters/opts # dd if=3D/dev/md111 of=3D/dev/null bs=3D4K count=3D1 iflag=3Ddirect & [1] 6322 # dd: error reading '/dev/md111': Input/output error 0+0 records in 0+0 records out 0 bytes copied, 124,376 s, 0,0 kB/s [1]+ Exit 1 dd if=3D/dev/md111 of=3D/dev/null bs=3D4K count=3D1 iflag=3Ddirect # mdadm -D /dev/md111/dev/md111: Version : 1.2 Creation Time : Wed May 2 10:55:35 2018 Raid Level : raid1 Array Size : 3904 Used Dev Size : 3904 Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Wed May 2 10:55:36 2018 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 33 0 active sync failfast /dev/sdc1 1 8 34 1 active sync failfast /dev/sdc2 Following is how I generated the write IO error and checked md device. After write IO error, one device was set as faulty. gohkim@ws00837:~$ sudo modprobe scsi_debug num_parts=3D2 gohkim@ws00837:~$ sudo mdadm -C /dev/md111 --failfast -l 1 -n 2 /dev/sdc1 /dev/sdc2 mdadm: Note: this array has metadata at the start and may not be suitable as a boot device. If you plan to store '/boot' on this device please ensure that your boot-loader understands md/v1.x metadata, or use --metadata=3D0.90 mdadm: largest drive (/dev/sdc2) exceeds size (3904K) by more than 1% Continue creating array? y mdadm: Defaulting to version 1.2 metadata mdadm: array /dev/md111 started. gohkim@ws00837:~$ sudo mdadm -D /dev/md111 /dev/md111: Version : 1.2 Creation Time : Wed May 2 14:03:30 2018 Raid Level : raid1 Array Size : 3904 Used Dev Size : 3904 Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Wed May 2 14:03:31 2018 State : clean Active Devices : 2 Working Devices : 2 Failed Devices : 0 Spare Devices : 0 Name : ws00837:111 (local to host ws00837) UUID : ba51fe65:c517a25a:a381ccc5:3617322b Events : 17 Number Major Minor RaidDevice State 0 8 33 0 active sync failfast /dev/sdc1 1 8 34 1 active sync failfast /dev/sdc2 gohkim@ws00837:~$ echo -1 | sudo tee /sys/module/scsi_debug/parameters/ever= y_nth -1 gohkim@ws00837:~$ echo 4 | sudo tee /sys/module/scsi_debug/parameters/opts 4 gohkim@ws00837:~$ sudo dd if=3D/dev/zero of=3D/dev/md111 bs=3D4K count=3D1 oflag=3Ddirect & [1] 13081 gohkim@ws00837:~$ dd: error writing '/dev/md111': Input/output error 1+0 records in 0+0 records out 0 bytes copied, 184,523 s, 0,0 kB/s [1]+ Exit 1 sudo dd if=3D/dev/zero of=3D/dev/md111 bs=3D4= K count=3D1 oflag=3Ddirect gohkim@ws00837:~$ sudo mdadm -D /dev/md111 /dev/md111: Version : 1.2 Creation Time : Wed May 2 14:03:30 2018 Raid Level : raid1 Array Size : 3904 Used Dev Size : 3904 Raid Devices : 2 Total Devices : 2 Persistence : Superblock is persistent Update Time : Wed May 2 14:07:47 2018 State : clean, degraded Active Devices : 1 Working Devices : 1 Failed Devices : 1 Spare Devices : 0 Number Major Minor RaidDevice State 0 8 33 0 active sync failfast /dev/sdc1 - 0 0 1 removed 1 8 34 - faulty failfast /dev/sdc2 --=20 GIOH KIM Linux Kernel Entwickler ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Tel: +49 176 2697 8962 Fax: +49 30 577 008 299 Email: gi-oh.kim@profitbricks.com URL: https://www.profitbricks.de Sitz der Gesellschaft: Berlin Registergericht: Amtsgericht Charlottenburg, HRB 125506 B Gesch=C3=A4ftsf=C3=BChrer: Achim Weiss, Matthias Steinberg, Christoph Steff= ens