linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yanggun <yang.geum.seok@gmail.com>
To: NeilBrown <neilb@suse.de>
Cc: Andrew Morton <akpm@osdl.org>, linux-raid@vger.kernel.org
Subject: Re: [PATCH md 017 of 18] Handle errors when read-only
Date: Sat, 10 Dec 2005 15:41:18 +0900	[thread overview]
Message-ID: <ee0ae26a0512092241v3ee5e445r@mail.gmail.com> (raw)
In-Reply-To: <1051127234104.14937@suse.de>

Hi Brown.

I have raid arrays, raid1 called md0. Basically they run fine, but
something is switching md0 readonly during write to disk(cp, mv);

Is changed by that RAID readonly in what case? let me know, describe 
number of case?

I am very anxious  about it very. Please, can you inform to me?  Does
this patch solve it? Can not you do to do not become by readonly?

Setup:
  HW:
   2 S-ATA-Disks (240GB each) -> /dev/md0 RAID-1
   Promise S150 TX2Plus - Controller
   Intel Pentium4  - 2.8GHz

  SW:
   Debian Linux Testing
   Kernel 2.6.13.2
   Software Raid-1



2005/11/28, NeilBrown <neilb@suse.de>:
>
>
> Signed-off-by: Neil Brown <neilb@suse.de>
>
> ### Diffstat output
>  ./drivers/md/raid1.c         |   18 +++++++++++-------
>  ./include/linux/raid/raid1.h |    7 +++++++
>  2 files changed, 18 insertions(+), 7 deletions(-)
>
> diff ./drivers/md/raid1.c~current~ ./drivers/md/raid1.c
> --- ./drivers/md/raid1.c~current~       2005-11-28 10:13:27.000000000 +1100
> +++ ./drivers/md/raid1.c        2005-11-28 10:13:32.000000000 +1100
> @@ -154,7 +154,7 @@ static void put_all_bios(conf_t *conf, r
>
>         for (i = 0; i < conf->raid_disks; i++) {
>                 struct bio **bio = r1_bio->bios + i;
> -               if (*bio)
> +               if (*bio && *bio != IO_BLOCKED)
>                         bio_put(*bio);
>                 *bio = NULL;
>         }
> @@ -418,11 +418,13 @@ static int read_balance(conf_t *conf, r1
>                 new_disk = 0;
>
>                 for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
> +                    r1_bio->bios[new_disk] == IO_BLOCKED ||
>                      !rdev || !test_bit(In_sync, &rdev->flags)
>                              || test_bit(WriteMostly, &rdev->flags);
>                      rdev = rcu_dereference(conf->mirrors[++new_disk].rdev)) {
>
> -                       if (rdev && test_bit(In_sync, &rdev->flags))
> +                       if (rdev && test_bit(In_sync, &rdev->flags) &&
> +                               r1_bio->bios[new_disk] != IO_BLOCKED)
>                                 wonly_disk = new_disk;
>
>                         if (new_disk == conf->raid_disks - 1) {
> @@ -436,11 +438,13 @@ static int read_balance(conf_t *conf, r1
>
>         /* make sure the disk is operational */
>         for (rdev = rcu_dereference(conf->mirrors[new_disk].rdev);
> +            r1_bio->bios[new_disk] == IO_BLOCKED ||
>              !rdev || !test_bit(In_sync, &rdev->flags) ||
>                      test_bit(WriteMostly, &rdev->flags);
>              rdev = rcu_dereference(conf->mirrors[new_disk].rdev)) {
>
> -               if (rdev && test_bit(In_sync, &rdev->flags))
> +               if (rdev && test_bit(In_sync, &rdev->flags) &&
> +                   r1_bio->bios[new_disk] != IO_BLOCKED)
>                         wonly_disk = new_disk;
>
>                 if (new_disk <= 0)
> @@ -477,7 +481,7 @@ static int read_balance(conf_t *conf, r1
>
>                 rdev = rcu_dereference(conf->mirrors[disk].rdev);
>
> -               if (!rdev ||
> +               if (!rdev || r1_bio->bios[disk] == IO_BLOCKED ||
>                     !test_bit(In_sync, &rdev->flags) ||
>                     test_bit(WriteMostly, &rdev->flags))
>                         continue;
> @@ -1334,7 +1338,7 @@ static void raid1d(mddev_t *mddev)
>                         sector_t sect = r1_bio->sector;
>                         int sectors = r1_bio->sectors;
>                         freeze_array(conf);
> -                       while(sectors) {
> +                       if (mddev->ro == 0) while(sectors) {
>                                 int s = sectors;
>                                 int d = r1_bio->read_disk;
>                                 int success = 0;
> @@ -1387,7 +1391,6 @@ static void raid1d(mddev_t *mddev)
>                                 sect += s;
>                         }
>
> -
>                         unfreeze_array(conf);
>
>                         bio = r1_bio->bios[r1_bio->read_disk];
> @@ -1398,7 +1401,8 @@ static void raid1d(mddev_t *mddev)
>                                        (unsigned long long)r1_bio->sector);
>                                 raid_end_bio_io(r1_bio);
>                         } else {
> -                               r1_bio->bios[r1_bio->read_disk] = NULL;
> +                               r1_bio->bios[r1_bio->read_disk] =
> +                                       mddev->ro ? IO_BLOCKED : NULL;
>                                 r1_bio->read_disk = disk;
>                                 bio_put(bio);
>                                 bio = bio_clone(r1_bio->master_bio, GFP_NOIO);
>
> diff ./include/linux/raid/raid1.h~current~ ./include/linux/raid/raid1.h
> --- ./include/linux/raid/raid1.h~current~       2005-11-28 10:13:11.000000000 +1100
> +++ ./include/linux/raid/raid1.h        2005-11-28 10:13:32.000000000 +1100
> @@ -109,6 +109,13 @@ struct r1bio_s {
>         /* DO NOT PUT ANY NEW FIELDS HERE - bios array is contiguously alloced*/
>  };
>
> +/* when we get a read error on a read-only array, we redirect to another
> + * device without failing the first device, or trying to over-write to
> + * correct the read error.  To keep track of bad blocks on a per-bio
> + * level, we store IO_BLOCKED in the appropriate 'bios' pointer
> + */
> +#define IO_BLOCKED ((struct bio*)1)
> +
>  /* bits for r1bio.state */
>  #define        R1BIO_Uptodate  0
>  #define        R1BIO_IsSync    1
> -
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2005-12-10  6:41 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-27 23:39 [PATCH md 000 of 18] Introduction NeilBrown
2005-11-27 23:39 ` [PATCH md 001 of 18] Improve read speed to raid10 arrays using 'far copies' NeilBrown
2005-11-27 23:39 ` [PATCH md 002 of 18] Fix locking problem in r5/r6 NeilBrown
2005-11-27 23:39 ` [PATCH md 003 of 18] Fix problem with raid6 intent bitmap NeilBrown
2005-11-27 23:39 ` [PATCH md 004 of 18] Set default_bitmap_offset properly in set_array_info NeilBrown
2005-11-27 23:40 ` [PATCH md 005 of 18] Fix --re-add for raid1 and raid6 NeilBrown
2005-11-27 23:40 ` [PATCH md 006 of 18] Improve raid1 "IO Barrier" concept NeilBrown
2005-11-27 23:40 ` [PATCH md 007 of 18] Improve raid10 " NeilBrown
2005-11-27 23:40 ` [PATCH md 008 of 18] Small cleanups for raid5 NeilBrown
2005-11-27 23:40 ` [PATCH md 010 of 18] Move bitmap_create to after md array has been initialised NeilBrown
2005-11-27 23:40 ` [PATCH md 011 of 18] Write intent bitmap support for raid10 NeilBrown
2005-11-27 23:40 ` [PATCH md 012 of 18] Fix raid6 resync check/repair code NeilBrown
2005-11-27 23:40 ` [PATCH md 013 of 18] Improve handing of read errors with raid6 NeilBrown
2005-11-30 22:33   ` Carlos Carvalho
2005-12-01  2:54     ` Neil Brown
2005-11-27 23:40 ` [PATCH md 014 of 18] Attempt to auto-correct read errors in raid1 NeilBrown
2005-11-29 16:38   ` Paul Clements
2005-11-29 23:21     ` Neil Brown
2005-11-27 23:40 ` [PATCH md 015 of 18] Tidyup some issues with raid1 resync and prepare for catching read errors NeilBrown
2005-11-27 23:40 ` [PATCH md 016 of 18] Better handling for read error in raid1 during resync NeilBrown
2005-11-27 23:41 ` [PATCH md 017 of 18] Handle errors when read-only NeilBrown
2005-12-10  6:41   ` Yanggun [this message]
2005-12-10  6:59     ` raid1 mysteriously switching to read-only Neil Brown
2005-12-10  7:50       ` Yanggun
2005-12-10  8:02         ` Neil Brown
2005-12-10  8:10           ` Yanggun
2005-12-10 12:10             ` Neil Brown
2005-12-11 13:04               ` Yanggun
2005-12-11 14:14                 ` Patrik Jonsson
2005-12-11 14:29                   ` Yanggun
2005-12-11 17:13                     ` Ross Vandegrift
2005-12-11 23:28                       ` Yanggun
2005-11-27 23:41 ` [PATCH md 018 of 18] Fix up some rdev rcu locking in raid5/6 NeilBrown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ee0ae26a0512092241v3ee5e445r@mail.gmail.com \
    --to=yang.geum.seok@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).