From: NeilBrown <neilb@suse.de>
To: Doug Ledford <dledford@redhat.com>
Cc: Jes.Sorensen@redhat.com, linux-raid@vger.kernel.org
Subject: Re: [PATCH 0/1] Make failure message on re-add more explcit
Date: Wed, 18 Apr 2012 14:25:23 +1000 [thread overview]
Message-ID: <20120418142523.25ca6a09@notabene.brown> (raw)
In-Reply-To: <4F84C5DA.2040501@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3089 bytes --]
Hi Doug.
Thanks for your long reply.
I would like to propose the following patch.
It addresses the issues that I am concerned about, and I don't think it
interferes with the usage patterns that you are concerned about.
Does it seems reasonable to you?
My apologies for the frustration this has cause you and your customers.
NeilBrown
commit 0a999759b54f94fd63ac0ee298a549acef6f7d6f
Author: NeilBrown <neilb@suse.de>
Date: Wed Apr 18 14:19:49 2012 +1000
Relax restrictions on when --add is permitted.
The restriction that --add was not allowed on a device which
looked like a recent member of an array was overly harsh.
The real requirement was to avoid using --add when the array had
failed, and the device being added might contain necessary
information which can only be incorporated by stopping and
re-assembling with --force.
So change the test to reflect the need.
Reported-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
diff --git a/Manage.c b/Manage.c
index 3767f01..95aa270 100644
--- a/Manage.c
+++ b/Manage.c
@@ -448,7 +448,7 @@ int Manage_subdevs(char *devname, int fd,
char *dnprintable = dv->devname;
char *add_dev = dv->devname;
int err;
- int re_add_failed = 0;
+ int array_failed;
next = dv->next;
jnext = 0;
@@ -851,9 +851,8 @@ int Manage_subdevs(char *devname, int fd,
continue;
goto abort;
}
- skip_re_add:
- re_add_failed = 1;
}
+ skip_re_add:
st->ss->free_super(st);
}
if (add_dev != dv->devname) {
@@ -875,12 +874,30 @@ int Manage_subdevs(char *devname, int fd,
dv->devname, devname);
goto abort;
}
- if (re_add_failed) {
- fprintf(stderr, Name ": %s reports being an active member for %s, but a --re-add fails.\n",
- dv->devname, devname);
- fprintf(stderr, Name ": not performing --add as that would convert %s in to a spare.\n",
- dv->devname);
- fprintf(stderr, Name ": To make this a spare, use \"mdadm --zero-superblock %s\" first.\n",
+ if (array.active_disks < array.raid_disks) {
+ char *avail = calloc(array.raid_disks, 1);
+ int d;
+ int found = 0;
+
+ for (d = 0; d < MAX_DISKS && found < array.active_disks; d++) {
+ disc.number = d;
+ if (ioctl(fd, GET_DISK_INFO, &disc))
+ continue;
+ if (disc.major == 0 && disc.minor == 0)
+ continue;
+ if (!(disc.state & (1<<MD_DISK_SYNC)))
+ continue;
+ avail[disc.raid_disk] = 1;
+ found++;
+ }
+ array_failed = !enough(array.level, array.raid_disks,
+ array.layout, 1, avail);
+ } else
+ array_failed = 0;
+ if (array_failed) {
+ fprintf(stderr, Name ": %s has failed so using --add cannot work and might destroy\n",
+ devname);
+ fprintf(stderr, Name ": data on %s. You should stop the array and re-assemble it.\n",
dv->devname);
if (tfd >= 0)
close(tfd);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-04-18 4:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 16:59 [PATCH 0/1] Make failure message on re-add more explcit Jes.Sorensen
2012-02-22 17:00 ` [PATCH 1/1] Make error message on failure to --re-add more explicit Jes.Sorensen
2012-02-22 22:04 ` [PATCH 0/1] Make failure message on re-add more explcit NeilBrown
2012-02-22 23:16 ` Jes Sorensen
2012-02-23 1:57 ` John Robinson
2012-02-23 8:34 ` Jes Sorensen
2012-02-23 8:47 ` J. Ali Harlow
2012-02-27 0:01 ` NeilBrown
2012-04-05 18:59 ` Doug Ledford
2012-04-09 23:41 ` NeilBrown
2012-04-10 23:44 ` Doug Ledford
2012-04-18 4:25 ` NeilBrown [this message]
2012-04-23 19:36 ` Doug Ledford
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=20120418142523.25ca6a09@notabene.brown \
--to=neilb@suse.de \
--cc=Jes.Sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
/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).