Re: [PATCH?] make __bio_add_page check q->max_hw_sectors

From: Jens Axboe
Date: Sun Oct 10 2004 - 03:17:08 EST


On Sun, Oct 10 2004, Adam J. Richter wrote:
> On an dm-crypt partiton on an IDE disk, 2.6.9-rc3 and
> 2.6.9-rc3-bk9 repeatedly generate the following error, which
> does not occur in 2.6.9-rc1:
>
> bio too big for device dm-0 (256 > 255)
>
> The stack trace looked something like this:
>
> submit_bio
> mpage_bio_submit
> mpage_readpages
> readpages
> do_page_cache_readahead
> filemap_nopage
> do_no_page
> handle_mm_fault
>
> Around 2.6.9-rc3, a new field q->max_hw_sectors was
> added to struct request_queue. I was able to make this
> problem disappear by the following patch, which adds a
> check of this new field to __bio_add_page. (I've edited
> this patch to hide other differences in my fs/bio.c, so
> it may be necessary to apply it by hand if patch fails.)
>
> I do not understand the intended difference between
> the new max_hw_sectors field and max_sectors, so it is unclear
> to me if it is a bug that my dm-crypt request_queue has
> q->max_hw_sectors < q->max_sectors. If q->max_hw_sectors
> is supposed to be guaranteed to be greater than or equal
> to q->max_sectors, then the real bug is elsewhere and my
> patch is unnecessary.

That's exactly correct, ->max_sectors must never be bigger than
max_hw_sectors, that is the real bug.

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