All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Mario 'BitKoenig' Holbe <Mario.Holbe@TU-Ilmenau.DE>
Cc: linux-raid@vger.kernel.org
Subject: Re: Incorrect in-kernel bitmap on raid10
Date: Sun, 19 Apr 2009 16:24:02 +1000	[thread overview]
Message-ID: <18922.50050.860008.242658@notabene.brown> (raw)
In-Reply-To: message from Mario 'BitKoenig' Holbe on Saturday April 18

On Saturday April 18, Mario.Holbe@TU-Ilmenau.DE wrote:
> Hello,
> 
> I created a 4.5T RAID10 with internal bitmap out of 3 1.5T disks on a
> Debian 2.6.28-1-686-bigmem kernel:
> # mdadm --create -l raid10 -n 6 -c 512 -b internal -a md /dev/md7 /dev/sdc1 missing /dev/sdd1 missing /dev/sde1 missing
> and I get a strange inconsistency between the on-disk and the in-kernel
> bitmap representation:

oops...

Could you let me know if that following patch helps?
This bug will affect RAID4,5,6 when the device exceeds 2 terabytes,
but it affects RAID10 when the array exceeds 2 terabytes.
(For RAID1, the device size and array size are the same, if it fits in
both categories).

Thanks,
NeilBrown


diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index e4510c9..1fb91ed 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1590,7 +1590,7 @@ void bitmap_destroy(mddev_t *mddev)
 int bitmap_create(mddev_t *mddev)
 {
 	struct bitmap *bitmap;
-	unsigned long blocks = mddev->resync_max_sectors;
+	sector_t blocks = mddev->resync_max_sectors;
 	unsigned long chunks;
 	unsigned long pages;
 	struct file *file = mddev->bitmap_file;
@@ -1632,8 +1632,8 @@ int bitmap_create(mddev_t *mddev)
 	bitmap->chunkshift = ffz(~bitmap->chunksize);
 
 	/* now that chunksize and chunkshift are set, we can use these macros */
- 	chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /
-			CHUNK_BLOCK_RATIO(bitmap);
+ 	chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) >>
+			CHUNK_BLOCK_SHIFT(bitmap);
  	pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO;
 
 	BUG_ON(!pages);

  reply	other threads:[~2009-04-19  6:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-18 18:15 Incorrect in-kernel bitmap on raid10 Mario 'BitKoenig' Holbe
2009-04-19  6:24 ` Neil Brown [this message]
2009-04-19 22:55   ` Mario 'BitKoenig' Holbe
2009-04-19 23:27     ` Neil Brown
2009-04-20  0:13       ` Race condition in write_sb_page? (was: Re: Incorrect in-kernel bitmap on raid10) Mario 'BitKoenig' Holbe
2009-04-20  1:57         ` NeilBrown
2009-04-20  8:03           ` Race condition in write_sb_page? Mario 'BitKoenig' Holbe
2009-04-22 18:45   ` Incorrect in-kernel bitmap on raid10 Mario 'BitKoenig' Holbe
2009-04-28 14:05     ` Mario 'BitKoenig' Holbe
2009-05-01  2:11       ` Neil Brown
2009-05-01 17:55         ` Mario 'BitKoenig' Holbe
2009-05-01 21:36           ` NeilBrown
2009-05-02 19:52             ` Mario 'BitKoenig' Holbe
2009-05-02 22:41               ` NeilBrown
2009-05-03 13:22                 ` Mario 'BitKoenig' Holbe
2009-05-07 20:25                   ` Mario 'BitKoenig' Holbe

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=18922.50050.860008.242658@notabene.brown \
    --to=neilb@suse.de \
    --cc=Mario.Holbe@TU-Ilmenau.DE \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.