linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <nfbrown@novell.com>
To: Dan Russell <dpr@aol.com>, linux-raid@vger.kernel.org
Subject: Re: Import/recover RAID6 created with SAS2108?
Date: Thu, 10 Mar 2016 18:02:26 +1100	[thread overview]
Message-ID: <87d1r2ke7x.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <ECED3C91-8D12-469E-A9AB-1337292DA216@aol.com>

[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]

On Wed, Mar 09 2016, Dan Russell wrote:

> # mdadm --create /dev/md1 --assume-clean --level=6 --raid-devices=24
     --chunk=64 --size=2929686528

22 * 2929686528 == 0xF01B45000
> # cat /proc/mdstat 
> Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 
> md1 : active (auto-read-only) raid6 dm-24[23] dm-23[22].....
>       17208463360 blocks super external:/md127/0 level 6, 64k chunk,....

17208463360 == 0x401B45000

So the size hasn't just be truncated to to some number of bits, but the
5th byte has changed from 0xF to 0x4.

That is very odd....

Ahhh.. I tried it myself, and used "mdadm -D" to look at the RAID6
array.

  Used Dev Size : 782202880 (745.97 GiB 800.98 GB)

The requested per-device size was
   2929686528 = 0xAE9F7800
the size given was
   782202880  = 0x2E9F7800

so we lost the msbit there...  Ahhhh.

diff --git a/super-ddf.c b/super-ddf.c
index faaf0a7ca9e0..0e00d17dd169 100644
--- a/super-ddf.c
+++ b/super-ddf.c
@@ -2688,10 +2688,10 @@ static int init_super_ddf_bvd(struct supertype *st,
 		free(vcl);
 		return 0;
 	}
-	vc->blocks = cpu_to_be64(info->size * 2);
+	vc->blocks = cpu_to_be64(size * 2);
 	vc->array_blocks = cpu_to_be64(
 		calc_array_size(info->level, info->raid_disks, info->layout,
-				info->chunk_size, info->size*2));
+				info->chunk_size, size*2));
 	memset(vc->pad1, 0xff, 8);
 	vc->spare_refs[0] = cpu_to_be32(0xffffffff);
 	vc->spare_refs[1] = cpu_to_be32(0xffffffff);


That was careless.  "info" is a legacy structure which has a 32bit size
field. So a 64bit size if passed as a separate arg, but this function
used the wrong one :-(

I'll send off a patch.

Thanks for the report - and glad you could get at your data :-)

NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

      parent reply	other threads:[~2016-03-10  7:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-06 21:37 Import/recover RAID6 created with SAS2108? Dan Russell
2016-03-07 21:50 ` Andreas Klauer
2016-03-09  3:20   ` Dan Russell
2016-03-09 19:27     ` Andreas Klauer
2016-03-09 20:53       ` Dan Russell
2016-03-10  7:02     ` NeilBrown [this message]

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=87d1r2ke7x.fsf@notabene.neil.brown.name \
    --to=nfbrown@novell.com \
    --cc=dpr@aol.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).