linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG/PATCH] md bitmap broken on big endian machines
@ 2006-09-21 20:26 Paul Clements
  2006-09-22 15:29 ` [PATCH] md SET_BITMAP_FILE compat ioctl Paul Clements
  2006-09-28  6:34 ` [BUG/PATCH] md bitmap broken on big endian machines Neil Brown
  0 siblings, 2 replies; 7+ messages in thread
From: Paul Clements @ 2006-09-21 20:26 UTC (permalink / raw)
  To: neilb; +Cc: linux-raid

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

Neil,

We just discovered this problem on a 64-bit IBM POWER (ppc64) system. 
The symptom was this BUG():

Sep 20 20:55:51 caspian kernel: kernel BUG in sync_request at 
drivers/md/raid1.c
:1743!
Sep 20 20:55:51 caspian kernel: Oops: Exception in kernel mode, sig: 5 [#1]
Sep 20 20:55:51 caspian kernel: SMP NR_CPUS=128 NUMA PSERIES LPAR
Sep 20 20:55:51 caspian kernel: Modules linked in: nbd raid1 ipv6 nfs 
lockd nfs_
acl sunrpc apparmor aamatch_pcre loop dm_mod e1000 ide_cd cdrom lpfc 
scsi_transp
ort_fc pdc202xx_new sg st ipr firmware_class sd_mod scsi_mod


I traced the problem back to a bad value in bitmap->chunkshift (the 
value was 8, instead of 16, with a chunksize of 64K). I think this means 
that bitmaps are broken on all big endian systems. It looks like we 
should be using ffs instead of find_first_bit. Patch has been compile 
tested only.

Thanks,
Paul

[-- Attachment #2: md_bitmap_find_first_bug.diff --]
[-- Type: text/plain, Size: 488 bytes --]

--- ./drivers/md/bitmap.c.orig	2006-09-21 16:10:17.000000000 -0400
+++ ./drivers/md/bitmap.c	2006-09-21 16:12:16.000000000 -0400
@@ -1578,8 +1578,7 @@ int bitmap_create(mddev_t *mddev)
 	if (err)
 		goto error;
 
-	bitmap->chunkshift = find_first_bit(&bitmap->chunksize,
-					sizeof(bitmap->chunksize));
+	bitmap->chunkshift = ffs(bitmap->chunksize) - 1;
 
 	/* now that chunksize and chunkshift are set, we can use these macros */
  	chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /

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

end of thread, other threads:[~2006-09-29  7:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-21 20:26 [BUG/PATCH] md bitmap broken on big endian machines Paul Clements
2006-09-22 15:29 ` [PATCH] md SET_BITMAP_FILE compat ioctl Paul Clements
2006-09-28  7:31   ` Neil Brown
2006-09-28  6:34 ` [BUG/PATCH] md bitmap broken on big endian machines Neil Brown
2006-09-28 22:09   ` Michael Tokarev
2006-09-29  0:48     ` Paul Clements
2006-09-29  7:03       ` Michael Tokarev

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).