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

Reply via email to