Skip to contentSkip to conversation

md: raid5 run(): Fix max_degraded for raid level 4.

PATCH In review Andre Noll 3 participants 5 messages Mar 18, 2009 – Mar 20, 2009

Subsystems (3)
lore
Share & tools
lore

Andre Noll

author
#0 lore raw

PATCH 1/1 md: raid5 run(): Fix max_degraded for raid level 4.

Hi Neil,

I found this one while trying to figure out why 3-disk raid6 arrays aren't supported. It's an obvious and trivial bug fix but probably not important enough for stable as it only affects raid4.

Regards
Andre

commit ea30abef4d1f3aad635eb24db082f3531b573540

Author: Andre Noll <[email protected]>
Date:   Wed Mar 18 13:43:08 2009 +0100

md: raid5 run(): Fix max_degraded for raid level 4.

raid4 allows only one failed disk.

drivers/md/raid5.c +1 -1
index a76ef52..ceb5924 100644
@@ -4484,7 +4484,7 @@ static int run(mddev_t *mddev)
 		 */
 		sector_t here_new, here_old;
 		int old_disks;
-		int max_degraded = (mddev->level == 5 ? 1 : 2);
+		int max_degraded = (mddev->level == 6 ? 2 : 1);
 
 		if (mddev->new_level != mddev->level ||
 		    mddev->new_layout != mddev->layout ||
Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe
#1 lore raw
Quoted 6 lines · On Wednesday March 18, [email protected] wrote:

Hi Neil,

I found this one while trying to figure out why 3-disk raid6 arrays aren't supported. It's an obvious and trivial bug fix but probably not important enough for stable as it only affects raid4.

Thanks!
Applied.

Have you tried a 3-disk raid6 yet? Any conclusions?

NeilBrown

Quoted 28 lines

Regards
Andre

commit ea30abef4d1f3aad635eb24db082f3531b573540

Author: Andre Noll <[email protected]>
Date:   Wed Mar 18 13:43:08 2009 +0100

md: raid5 run(): Fix max_degraded for raid level 4.

raid4 allows only one failed disk.

drivers/md/raid5.c +1 -1
index a76ef52..ceb5924 100644
@@ -4484,7 +4484,7 @@ static int run(mddev_t *mddev)
 		 */
 		sector_t here_new, here_old;
 		int old_disks;
-		int max_degraded = (mddev->level == 5 ? 1 : 2);
+		int max_degraded = (mddev->level == 6 ? 2 : 1);
 
 		if (mddev->new_level != mddev->level ||
 		    mddev->new_layout != mddev->layout ||
Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe
author
#2 lore raw

Re: [PATCH] relax checks to support 3disk raid6 arrays

Quoted 1 line · Neil Brown

Have you tried a 3-disk raid6 yet? Any conclusions?

Yes, I played around a bit and used the two attached patches that relax some checks in the kernel and in mdadm. It appears to work fine, but I did only minimal testing with small loop devices, so I would not recommend it for production use yet :)

Regards
Andre

Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe
crypto/async_tx/async_pq.c +2 -2
index f375a27..2922e9f 100644
@@ -395,7 +395,7 @@ async_pq_zero_sum(struct page **blocks, unsigned int offset, int src_cnt,
 	struct dma_async_tx_descriptor *tx = NULL;
 	enum dma_ctrl_flags dma_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;
 
-	BUG_ON(src_cnt < 2);
+	BUG_ON(src_cnt < 1);
 
 	if (device && src_cnt <= dma_maxpq(device, 0) - 2) {
 		dma_addr_t dma_src[src_cnt + 2];
@@ -486,7 +486,7 @@ async_syndrome_zero_sum(struct page **blocks, unsigned int offset, int src_cnt,
 	struct dma_async_tx_descriptor *tx = NULL;
 	enum dma_ctrl_flags dma_flags = cb_fn ? DMA_PREP_INTERRUPT : 0;
 
-	BUG_ON(src_cnt < 2);
+	BUG_ON(src_cnt < 1);
 
 	if (device && src_cnt <= dma_maxpq(device, 0) - 2) {
 		dma_addr_t dma_src[src_cnt + 2];
crypto/async_tx/async_xor.c +1 -1
index 50cd370..70869bb 100644
@@ -183,7 +183,7 @@ async_xor(struct page *dest, struct page **src_list, unsigned int offset,
 	struct dma_chan *chan = async_tx_find_channel(depend_tx, DMA_XOR,
 						      &dest, 1, src_list,
 						      src_cnt, len);
-	BUG_ON(src_cnt <= 1);
+	BUG_ON(src_cnt < 1);
 
 	if (chan) {
 		/* run the xor asynchronously */
drivers/md/raid5.c +2 -2
index a76ef52..5ce7090 100644
@@ -4357,8 +4357,8 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
 		       mdname(mddev), mddev->new_layout);
 		return ERR_PTR(-EIO);
 	}
-	if (mddev->new_level == 6 && mddev->raid_disks < 4) {
-		printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n",
+	if (mddev->new_level == 6 && mddev->raid_disks < 3) {
+		printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 3)\n",
 		       mdname(mddev), mddev->raid_disks);
 		return ERR_PTR(-EINVAL);
 	}
Create.c +1 -1
index 9e65d0a..bd79838 100644
@@ -96,7 +96,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
 			Name ": a RAID level is needed to create an array.\n");
 		return 1;
 	}
-	if (raiddisks < 4 && level == 6) {
+	if (raiddisks < 3 && level == 6) {
 		fprintf(stderr,
 			Name ": at least 4 raid-devices needed for level 6\n");
 		return 1;
#3 lore raw

Re: [PATCH] relax checks to support 3disk raid6 arrays

Quoted 4 lines · Andre Noll
Quoted 1 line · Neil Brown

Have you tried a 3-disk raid6 yet? Any conclusions?

Quoted 8 lines

Yes, I played around a bit and used the two attached patches that relax some checks in the kernel and in mdadm. It appears to work fine, but I did only minimal testing with small loop devices, so I would not recommend it for production use yet :)

Regards
Andre

In the last lines of the patch:
Name ": at least 4 raid-devices needed for level 6\n");

Cheers

author
#4 lore raw

Re: [PATCH] relax checks to support 3disk raid6 arrays

Quoted 2 lines · Peter Rabbitson

In the last lines of the patch:
Name ": at least 4 raid-devices needed for level 6\n");

Thanks, obviously I overlooked this. Of course this omission only causes mdadm to print an incorrect message.

Regards
Andre

Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe