* [PATCH md 000 of 3] Introduction
@ 2005-09-06 3:52 NeilBrown
2005-09-06 3:53 ` [PATCH md 001 of 3] Really get sb_size setting right in all cases NeilBrown
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: NeilBrown @ 2005-09-06 3:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid
Here are three patches for md in 2.6.13-mm1
The first (embarassment) gets sb_size initialisation REALLY right.
I did more testing with mdadm-v1 and found hot-add wasn't working
either. This patch definitely covers all cases.
The other two fix problems with raid10 when enough drives fails that
not all block are available. It was particularly a problem as recovery
would BUG-out, but other issues are fixed to.
These patches are tested and suitable for early release to Linus.
Thanks,
NeilBrown
[PATCH md 001 of 3] Really get sb_size setting right in all cases.
[PATCH md 002 of 3] Fix raid10 assembly when too many devices are missing.
[PATCH md 003 of 3] Fix BUG when raid10 rebuilds without enough drives.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH md 001 of 3] Really get sb_size setting right in all cases.
2005-09-06 3:52 [PATCH md 000 of 3] Introduction NeilBrown
@ 2005-09-06 3:53 ` NeilBrown
2005-09-06 3:53 ` [PATCH md 002 of 3] Fix raid10 assembly when too many devices are missing NeilBrown
2005-09-06 3:53 ` [PATCH md 003 of 3] Fix BUG when raid10 rebuilds without enough drives NeilBrown
2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2005-09-06 3:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid
There was another case where sb_size wasn't being set, so
instead do the sensible thing and set if when filling in the
content of a superblock. That ensures that whenever we
write a superblock, the sb_size MUST be set.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~ 2005-09-02 19:29:31.000000000 +1000
+++ ./drivers/md/md.c 2005-09-05 14:47:45.000000000 +1000
@@ -712,6 +712,8 @@ static void super_90_sync(mddev_t *mddev
int i;
int active=0, working=0,failed=0,spare=0,nr_disks=0;
+ rdev->sb_size = MD_SB_BYTES;
+
sb = (mdp_super_t*)page_address(rdev->sb_page);
memset(sb, 0, sizeof(*sb));
@@ -2303,8 +2305,6 @@ static int add_new_disk(mddev_t * mddev,
else
rdev->in_sync = 0;
- rdev->sb_size = MD_SB_BYTES;
-
if (info->state & (1<<MD_DISK_WRITEMOSTLY))
set_bit(WriteMostly, &rdev->flags);
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH md 002 of 3] Fix raid10 assembly when too many devices are missing.
2005-09-06 3:52 [PATCH md 000 of 3] Introduction NeilBrown
2005-09-06 3:53 ` [PATCH md 001 of 3] Really get sb_size setting right in all cases NeilBrown
@ 2005-09-06 3:53 ` NeilBrown
2005-09-06 3:53 ` [PATCH md 003 of 3] Fix BUG when raid10 rebuilds without enough drives NeilBrown
2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2005-09-06 3:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid
if you try to assemble an array with too many missing devices,
raid10 will now reject the attempt, instead of allowing it.
Also check when hot-adding a drive and refuse the hot-add if
the array is beyond hope.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid10.c | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff ./drivers/md/raid10.c~current~ ./drivers/md/raid10.c
--- ./drivers/md/raid10.c~current~ 2005-09-06 13:05:59.000000000 +1000
+++ ./drivers/md/raid10.c 2005-09-06 13:09:22.000000000 +1000
@@ -906,6 +906,27 @@ static void close_sync(conf_t *conf)
conf->r10buf_pool = NULL;
}
+/* check if there are enough drives for
+ * every block to appear on atleast one
+ */
+static int enough(conf_t *conf)
+{
+ int first = 0;
+
+ do {
+ int n = conf->copies;
+ int cnt = 0;
+ while (n--) {
+ if (conf->mirrors[first].rdev)
+ cnt++;
+ first = (first+1) % conf->raid_disks;
+ }
+ if (cnt == 0)
+ return 0;
+ } while (first != 0);
+ return 1;
+}
+
static int raid10_spare_active(mddev_t *mddev)
{
int i;
@@ -944,6 +965,8 @@ static int raid10_add_disk(mddev_t *mdde
* very different from resync
*/
return 0;
+ if (!enough(conf))
+ return 0;
for (mirror=0; mirror < mddev->raid_disks; mirror++)
if ( !(p=conf->mirrors+mirror)->rdev) {
@@ -1684,9 +1707,10 @@ static int run(mddev_t *mddev)
init_waitqueue_head(&conf->wait_idle);
init_waitqueue_head(&conf->wait_resume);
- if (!conf->working_disks) {
- printk(KERN_ERR "raid10: no operational mirrors for %s\n",
- mdname(mddev));
+ /* need to check that every block has at least one working mirror */
+ if (!enough(conf)) {
+ printk(KERN_ERR "raid10: not enough operational mirrors for %s\n",
+ mdname(mddev));
goto out_free_conf;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH md 003 of 3] Fix BUG when raid10 rebuilds without enough drives.
2005-09-06 3:52 [PATCH md 000 of 3] Introduction NeilBrown
2005-09-06 3:53 ` [PATCH md 001 of 3] Really get sb_size setting right in all cases NeilBrown
2005-09-06 3:53 ` [PATCH md 002 of 3] Fix raid10 assembly when too many devices are missing NeilBrown
@ 2005-09-06 3:53 ` NeilBrown
2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2005-09-06 3:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid
This shouldn't be a BUG. We should cope.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/raid10.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff ./drivers/md/raid10.c~current~ ./drivers/md/raid10.c
--- ./drivers/md/raid10.c~current~ 2005-09-06 13:09:22.000000000 +1000
+++ ./drivers/md/raid10.c 2005-09-06 13:11:23.000000000 +1000
@@ -1474,7 +1474,13 @@ static sector_t sync_request(mddev_t *md
}
}
if (j == conf->copies) {
- BUG();
+ /* Cannot recover, so abort the recovery */
+ put_buf(r10_bio);
+ r10_bio = rb2;
+ if (!test_and_set_bit(MD_RECOVERY_ERR, &mddev->recovery))
+ printk(KERN_INFO "raid10: %s: insufficient working devices for recovery.\n",
+ mdname(mddev));
+ break;
}
}
if (biolist == NULL) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-06 3:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-06 3:52 [PATCH md 000 of 3] Introduction NeilBrown
2005-09-06 3:53 ` [PATCH md 001 of 3] Really get sb_size setting right in all cases NeilBrown
2005-09-06 3:53 ` [PATCH md 002 of 3] Fix raid10 assembly when too many devices are missing NeilBrown
2005-09-06 3:53 ` [PATCH md 003 of 3] Fix BUG when raid10 rebuilds without enough drives NeilBrown
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).