On Wed, May 2, 2012 at 11:50 PM, NeilBrown <neilb@xxxxxxx> wrote: > > I've managed to find a bug, but it is fairly minor and I cannot see how > it would cause a crash. > > The calculation of bitmap->chunks is wrong and will usually be 1 too small. > > Does it make a difference for you? I tend to doubt it. > > Thanks, > NeilBrown > > > diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c > index 97e73e5..17e2b47 100644 > --- a/drivers/md/bitmap.c > +++ b/drivers/md/bitmap.c > @@ -1727,8 +1727,7 @@ int bitmap_create(struct mddev *mddev) > bitmap->chunkshift = (ffz(~mddev->bitmap_info.chunksize) > - BITMAP_BLOCK_SHIFT); > > - /* now that chunksize and chunkshift are set, we can use these macros */ > - chunks = (blocks + bitmap->chunkshift - 1) >> > + chunks = (blocks + (1 << bitmap->chunkshift) - 1) >> > bitmap->chunkshift; > pages = (chunks + PAGE_COUNTER_RATIO - 1) / PAGE_COUNTER_RATIO; > > diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h > index 55ca5ae..b44b0aba 100644 > --- a/drivers/md/bitmap.h > +++ b/drivers/md/bitmap.h > @@ -101,9 +101,6 @@ typedef __u16 bitmap_counter_t; > > #define BITMAP_BLOCK_SHIFT 9 > > -/* how many blocks per chunk? (this is variable) */ > -#define CHUNK_BLOCK_RATIO(bitmap) ((bitmap)->mddev->bitmap_info.chunksize >> BITMAP_BLOCK_SHIFT) > - > #endif > > /* Somehow gmail marked this email as read, too, so I missed it. Anyway, that did it! With this patch applied I can successfully boot! I tested the offending commit by itself first with the all-zeros uuid patch applied and confirmed the bug was still present, then applied this patch and the bug was gone. I also applied this patch to 3.4-rc5 and confirmed that it was still good. Thank you for your help on this issue, and thank you for your work as a kernel developer and supporting this crucial component. Sincerely, Karl Newman -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html