linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: RAID10 overwrites partition tables
@ 2004-11-27 18:12 Felix Bellaby
  0 siblings, 0 replies; 3+ messages in thread
From: Felix Bellaby @ 2004-11-27 18:12 UTC (permalink / raw)
  To: Neil Brown; +Cc: linux-raid, linux-kernel

On Friday November 27, Neil Brown wrote
>>    	 mdadm --level 10 does not seem to respect disk partition boundaries.
> 
> Hmmm, yes, thanks.
>
> I think the following should fix the bug.  It only affects 'resync'
> not normal IO or recovery (after a drive has failed).
> ...
> diff ./drivers/md/raid10.c~current~ ./drivers/md/raid10.c
>  --- ./drivers/md/raid10.c~current~	2004-11-16 16:33:50.000000000 +1100
> +++ ./drivers/md/raid10.c	2004-11-27 11:00:06.000000000 +1100
> @@ -1150,6 +1150,7 @@ static void sync_request_write(mddev_t *
>  		md_sync_acct(conf->mirrors[d].rdev->bdev, tbio->bi_size >> 9);
>  
>  		tbio->bi_sector += conf->mirrors[d].rdev->data_offset;
> +		tbio->bi_bdev = conf->mirrors[d].rdev->bdev;
>  		generic_make_request(tbio);
>  	}
 
Thanks, the adjustments to the bio before the generic_make_request do the trick
nicely.

Note that the version of raid10.c in the current Fedora 3 series does not include
either of the adjustments so the patch required against that version becomes:

diff ./drivers/md/raid10.c~ ./drivers/md/raid10.c
 --- ./drivers/md/raid10.c~	2004-11-16 16:33:50.000000000 +1100
+++ ./drivers/md/raid10.c     2004-11-27 11:00:06.000000000 +1100
@@ -1145,6 +1145,8 @@
                atomic_inc(&r10_bio->remaining);
 		md_sync_acct(conf->mirrors[d].rdev->bdev, tbio->bi_size >> 9);
 
+	       tbio->bi_sector += conf->mirrors[d].rdev->data_offset;
+	       tbio->bi_bdev = conf->mirrors[d].rdev->bdev;
 	 	generic_make_request(tbio);
 	}

Thanks again,

Felix

 

-- 

Whatever you Wanadoo:
http://www.wanadoo.co.uk/time/

This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm

^ permalink raw reply	[flat|nested] 3+ messages in thread
* RAID10 overwrites partition tables
@ 2004-11-26 17:28 Felix Bellaby
  2004-11-27  0:02 ` Neil Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Felix Bellaby @ 2004-11-26 17:28 UTC (permalink / raw)
  To: linux-raid; +Cc: neilb

   	 mdadm --level 10 does not seem to respect disk partition boundaries.

Whilst trying to construct a small RAID10 array on a workstation, I naturally attempted
to set the array up over partitions to leave somewhere for grub to access the kernel.
Using partitions also assists with booting Fedora 3 as it relies on RAID autodetection
and partition labels in its standard initial ram disk.

However, the RAID10 seems to overwrite some of the partition tables.

For example, configuring a RAID10 array over 3 partitions as follows:

       mdadm --create /dev/md0 --level 10 --raid-devices 3 \
               /dev/sda1 /dev/sdb1 /dev/sdc1

seems to overwrite the partition tables for the disks in the
same way as configuring RAID10 over the complete disks:

       mdadm --create /dev/md0 --level 10 --raid-devices 3 \
               /dev/sda /dev/sdb /dev/sdc

A more detailed example:

       echo ',,fd' | sfdisk /dev/sda
       echo ',,fd' | sfdisk /dev/sdb
       echo ',,fd' | sfdisk /dev/sdc

       mdadm --create /dev/md0 --level 10 --raid-devices 3 \
               /dev/sda1 /dev/sdb1 /dev/sdc1

       mke2fs /dev/md0

       sfdisk -d /dev/sda
       sfdisk -d /dev/sdb
       sfdisk -d /dev/sdc

One of the partition tables in the above example will be replaced with
the start of the second chunk of the ext2 fs, just as one would expect
with an array configured over /dev/sda, dev/sdb and /dev/sdc.

The problem appears consistently on my test system (minimal Fedora 3 on
an NForce3 system using the sata_nv.ko device driver). I have had the
same results with a separate, identical system, and when using various
custom 2.6.9 kernels. However, the problems do not appear with RAID5.

The code in raid10.c is probably to blame. A cursory examination suggests
that raid10.c accesses the configured devices using very similar code to
raid1.c (where the problem might go unnoticed) but rather differently from
raid5.c.

Felix


-- 

Whatever you Wanadoo:
http://www.wanadoo.co.uk/time/

This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-11-27 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 18:12 RAID10 overwrites partition tables Felix Bellaby
  -- strict thread matches above, loose matches on Subject: below --
2004-11-26 17:28 Felix Bellaby
2004-11-27  0:02 ` 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).