* Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2
@ 2008-10-14 16:28 thomas62186218
2008-10-15 3:32 ` Neil Brown
0 siblings, 1 reply; 4+ messages in thread
From: thomas62186218 @ 2008-10-14 16:28 UTC (permalink / raw)
To: linux-raid
Hi all,
I have come across what is a potential bug in mdadm 2.6.7. (unless I am
missing something)
Environment:
Ubuntu Linux 8.0.4 64-bit (Hardy)
Intel dual socket quad-core server with 16GB RAM
10 SATA II 500GB hard drives
mdadm v2.6.7
Test 1: Attempt to grow linear md device with v1.0 superblock with
additional hard drive. Failed.
root@localhost:/usr/local/apache2/htdocs# mdadm --grow /dev/md6 --add
/dev/sdd1
mdadm: internal error - sb_offset is wrong
Aborted
Test 2: Attempt to grow linear md device with v1.0 superblock with
another linear md device with 1.0 superblock. Failed.
root@localhost:/usr/local/apache2/htdocs# mdadm --grow /dev/md6 --add
/dev/md5
mdadm: internal error - sb_offset is wrong
Aborted
Test 3: Attempt to grow linear md device with default 0.9 superblock
with additional hard drive. Success.
root@localhost:/usr/local/apache2/htdocs# mdadm -C -f -R /dev/md7 -l
linear -n 2 /dev/sdb1 /dev/sdc1
mdadm: array /dev/md7 started.
root@localhost:/usr/local/apache2/htdocs# mdadm --grow /dev/md7 --add
/dev/sdd1
root@localhost:/usr/local/apache2/htdocs# cat /proc/mdstat
Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5]
[raid4] [raid10]
md7 : active linear sdd1[2] sdc1[1] sdb1[0]
1025436608 blocks 64k rounding
unused devices: <none>
I would appreciate any thoughts on this. I definitely want to use the
more modern superblock version but I also need the ability to grow
linear md's.
Also, any plans on enabling "reshaping" or growth for RAID 0 and RAID
10 md's?
Thanks!
-Thomas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2
2008-10-14 16:28 Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2 thomas62186218
@ 2008-10-15 3:32 ` Neil Brown
2008-10-17 12:50 ` thomas62186218
0 siblings, 1 reply; 4+ messages in thread
From: Neil Brown @ 2008-10-15 3:32 UTC (permalink / raw)
To: thomas62186218; +Cc: linux-raid
On Tuesday October 14, thomas62186218@aol.com wrote:
> Hi all,
>
> I have come across what is a potential bug in mdadm 2.6.7. (unless I am
> missing something)
>
> Environment:
> Ubuntu Linux 8.0.4 64-bit (Hardy)
> Intel dual socket quad-core server with 16GB RAM
> 10 SATA II 500GB hard drives
> mdadm v2.6.7
>
> Test 1: Attempt to grow linear md device with v1.0 superblock with
> additional hard drive. Failed.
>
> root@localhost:/usr/local/apache2/htdocs# mdadm --grow /dev/md6 --add
> /dev/sdd1
> mdadm: internal error - sb_offset is wrong
> Aborted
Hm, that's bad.
I've tested growing linear devices with 1.0 superblocks and it works.
But I only tested the case where the new device is exactly the same
size as the other devices in the array. I'm guess this isn't the case
for you.
Are you able to test with the patch below applied?
Thanks.
>
> Also, any plans on enabling "reshaping" or growth for RAID 0 and RAID
> 10 md's?
Lots of plans. Not so much time.
NeilBrown
diff --git a/super1.c b/super1.c
index bec0c5e..62a3ab9 100644
--- a/super1.c
+++ b/super1.c
@@ -599,7 +599,7 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
}
if (strcmp(update, "linear-grow-new") == 0) {
int i;
- int rfd;
+ int rfd, fd;
int max = __le32_to_cpu(sb->max_dev);
for (i=0 ; i < max ; i++)
@@ -620,6 +620,25 @@ static int update_super1(struct supertype *st, struct mdinfo *info,
sb->dev_roles[i] =
__cpu_to_le16(info->disk.raid_disk);
+
+ fd = open(devname, O_RDONLY);
+ if (fd >= 0) {
+ unsigned long long ds;
+ get_dev_size(fd, devname, &ds);
+ close(fd);
+ ds >>= 9;
+ if (__le64_to_cpu(sb->super_offset) <
+ __le64_to_cpu(sb->data_offset)) {
+ sb->data_size = __cpu_to_le64(
+ ds - __le64_to_cpu(sb->data_offset));
+ } else {
+ ds -= 8*2;
+ ds &= ~(unsigned long long)(4*2-1);
+ sb->super_offset = __cpu_to_le64(ds);
+ sb->data_size = __cpu_to_le64(
+ ds - __le64_to_cpu(sb->data_offset));
+ }
+ }
}
if (strcmp(update, "linear-grow-update") == 0) {
sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2
2008-10-15 3:32 ` Neil Brown
@ 2008-10-17 12:50 ` thomas62186218
2008-10-20 1:15 ` Neil Brown
0 siblings, 1 reply; 4+ messages in thread
From: thomas62186218 @ 2008-10-17 12:50 UTC (permalink / raw)
To: neilb; +Cc: linux-raid
Hi Neil,
Thank you for the reply and the patch. I patched 2.6.7 (had to tweak
the patch a little), but this patch seems to have done the trick. I can
now resize linear arrays of different sizes even with superblock 1.0.
Was this patch already out there? Or is this a new one? If new, will
this be committed in?
Thanks again!
-Thomas
-----Original Message-----
From: Neil Brown <neilb@suse.de>
To: thomas62186218@aol.com
Cc: linux-raid@vger.kernel.org
Sent: Tue, 14 Oct 2008 8:32 pm
Subject: Re: Potential mdadm 2.6.7 bug: Cannot grow linear arrays with
superblock v1.0, 1.1, or 1.2
On Tuesday October 14, thomas62186218@aol.com wrote:
> Hi all,
>
> I have come across what is a potential bug in mdadm 2.6.7. (unless I
am
> missing something)
>
> Environment:
> Ubuntu Linux 8.0.4 64-bit (Hardy)
> Intel dual socket quad-core server with 16GB RAM
> 10 SATA II 500GB hard drives
> mdadm v2.6.7
>
> Test 1: Attempt to grow linear md device with v1.0 superblock with
> additional hard drive. Failed.
>
> root@localhost:/usr/local/apache2/htdocs# mdadm --grow /dev/md6 --add
> /dev/sdd1
> mdadm: internal error - sb_offset is wrong
> Aborted
Hm, that's bad.
I've tested growing linear devices with 1.0 superblocks and it works.
But I only tested the case where the new device is exactly the same
size as the other devices in the array. I'm guess this isn't the case
for you.
Are you able to test with the patch below applied?
Thanks.
>
> Also, any plans on enabling "reshaping" or growth for RAID 0 and RAID
> 10 md's?
Lots of plans. Not so much time.
NeilBrown
diff --git a/super1.c b/super1.c
index bec0c5e..62a3ab9 100644
--- a/super1.c
+++ b/super1.c
@@ -599,7 +599,7 @@ static int update_super1(struct supertype *st,
struct mdinfo
*info,
}
if (strcmp(update, "linear-grow-new") == 0) {
int i;
- int rfd;
+ int rfd, fd;
int max = __le32_to_cpu(sb->max_dev);
for (i=0 ; i < max ; i++)
@@ -620,6 +620,25 @@ static int update_super1(struct supertype *st,
struct
mdinfo *info,
sb->dev_roles[i] =
__cpu_to_le16(info->disk.raid_disk);
+
+ fd = open(devname, O_RDONLY);
+ if (fd >= 0) {
+ unsigned long long ds;
+ get_dev_size(fd, devname, &ds);
+ close(fd);
+ ds >>= 9;
+ if (__le64_to_cpu(sb->super_offset) <
+ __le64_to_cpu(sb->data_offset)) {
+ sb->data_size = __cpu_to_le64(
+ ds - __le64_to_cpu(sb->data_offset));
+ } else {
+ ds -= 8*2;
+ ds &= ~(unsigned long long)(4*2-1);
+ sb->super_offset = __cpu_to_le64(ds);
+ sb->data_size = __cpu_to_le64(
+ ds - __le64_to_cpu(sb->data_offset));
+ }
+ }
}
if (strcmp(update, "linear-grow-update") == 0) {
sb->raid_disks = __cpu_to_le32(info->array.raid_disks);
--
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2
2008-10-17 12:50 ` thomas62186218
@ 2008-10-20 1:15 ` Neil Brown
0 siblings, 0 replies; 4+ messages in thread
From: Neil Brown @ 2008-10-20 1:15 UTC (permalink / raw)
To: thomas62186218; +Cc: linux-raid
On Friday October 17, thomas62186218@aol.com wrote:
> Hi Neil,
>
> Thank you for the reply and the patch. I patched 2.6.7 (had to tweak
> the patch a little), but this patch seems to have done the trick. I can
> now resize linear arrays of different sizes even with superblock 1.0.
Thanks for reporting back.
>
> Was this patch already out there? Or is this a new one? If new, will
> this be committed in?
This is in my git tree
http://neil.brown.name/git?p=mdadm;a=commitdiff;h=1c6cb603fa60d3425f4d4b76e721b485bb006fcb
and so will be in 2.6.8 and 3.0 whenever I release those.
NeilBrown
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-10-20 1:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-14 16:28 Potential mdadm 2.6.7 bug: Cannot grow linear arrays with superblock v1.0, 1.1, or 1.2 thomas62186218
2008-10-15 3:32 ` Neil Brown
2008-10-17 12:50 ` thomas62186218
2008-10-20 1:15 ` Neil Brown
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).