Re: [boot crash] Re: [GIT PULL[ block drivers bits for 3.8

From: Jens Axboe
Date: Tue Dec 18 2012 - 06:43:17 EST


On 2012-12-18 10:25, Ingo Molnar wrote:
>
> * Jens Axboe <axboe@xxxxxxxxx> wrote:
>
>> Hi Linus,
>>
>> Now that the core bits are in, here are the driver bits for 3.8. The
>> branch contains:
>
> FYI, I'm getting a divide-by-zero boot crash (serial log capture
> below) with the attached config.
>
> Reproduced with 848b81415c42.
>
> The bug might have gone upstream between 8874e81 (Linus's tree
> from yesterday) and 848b81415c42 (Linus's tree from today). Or
> it's from earlier and I only triggered it today.
>
> ( Note that every log line is duplicated, haven't tracked that
> down yet, earlyprintk=,keep might be busted. )

Bah. Does the below fix it up for you?

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index acb4f7b..067f195 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -1188,12 +1188,13 @@ static inline int queue_discard_alignment(struct request_queue *q)

static inline int queue_limit_discard_alignment(struct queue_limits *lim, sector_t sector)
{
- sector_t alignment = sector << 9;
- alignment = sector_div(alignment, lim->discard_granularity);
+ sector_t alignment;

- if (!lim->max_discard_sectors)
+ if (!lim->max_discard_sectors || !lim->discard_granularity)
return 0;

+ alignment = sector << 9;
+ alignment = sector_div(alignment, lim->discard_granularity);
alignment = lim->discard_granularity + lim->discard_alignment - alignment;
return sector_div(alignment, lim->discard_granularity);
}

--
Jens Axboe

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