Re: PATCH: 2.4.0-test1-ac13: MD Linear driver ofs_by_one bug fix

From: Neil Brown (neilb@cse.unsw.edu.au)
Date: Sun Jun 11 2000 - 21:55:57 EST


On Monday June 12, aia21@cus.cam.ac.uk wrote:
> Alan, Ingo and LKML,
>
> This little patch fixes a offset by one error in the Linear MD - Software
> Raid - driver.
>
> This bug was only triggered when the block size is set to 512 (bytes),
> which is the case for many NTFS partitions for example! (I was hacking
> towards getting my volume set to work with the linux driver.)

I'm not against this in principle, but I think it exposes a larger
issue that should be dealt with (or at least looked in to) all at
once.

There are a number of places in the md driver where is assumes a basic
block size of 1K - and allows integral multiples of that.
If we want md to support 512byte access, they should probably all be
changed.
The change that you suggest may well be enough to fix linear, but it
leaves the problem in raid{0,1,5} and leaves the whole in an
inconsistant state.

Now that I know there is someone who actually wants 512 byte blocks, I
will add it to me todo list at
  http://www.cse.unsw.edu.au/~neilb/oss/raid/

NeilBrown

>
> The bug is that in the function linear_make_request there is a
> block = bh->b_rsector >> 1;
> and later on a:
> bh->b_rsector = (block - tmp_dev->offset) << 1;
> This however looses the least significant bit of bh->b_rsector!
>
> The effect was that looking at /dev/md0 (my volume set) after mounting the
> device using the NTFS driver the first 512 (bytes) of data were repeated
> again at offset 512 and the original data that was supposed to
> be at offset 512 had disappeared into the ether...
> And the same repeated itself ad infinitum: offset 1024, 512bytes repeated
> at offset 1536,... you get the picture.
>
> The fix (IMHO obviously correct) is to change the bh->b_rsector =... to:
> bh->b_rsector = ((block - tmp_dev->offset) << 1) + (bh->b_rsector & 1);
>
> A patch is attached which fixes this.
>
> With the patch mounting the volume set and doing a hexedit /dev/md0 shows
> the correct data (check by comparing with /dev/sda6, my first volume set
> partition).
>
> Unless Ingo or someone else has any reasons for _not_ making this change,
> I would like to ask Alan to apply the attached patch to the latest
> 2.4.0-test1-acXX kernel. (patch is against 2.4.0-test1-ac13)
>
> Regards,
>
> Anton
>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:24 EST