[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4j4W9A3Okq9KtU8wmSO4OyTBh8AqtFmLG9VO5bWAwwODw@mail.gmail.com>
Date: Wed, 11 Mar 2015 20:21:29 -0400
From: Dan Williams <dan.j.williams@...el.com>
To: Ross Zwisler <ross.zwisler@...ux.intel.com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>
Subject: Re: [Linux-nvdimm] [PATCH] brd: Ensure that bio_vecs have size <= PAGE_SIZE
On Wed, Mar 11, 2015 at 1:02 PM, Ross Zwisler
<ross.zwisler@...ux.intel.com> wrote:
> The functions copy_from_brd() and copy_to_brd() are written with an
> assumption that the bio_vec they are given has size <= PAGE_SIZE. This
> assumption is not enforced in any way, and if the bio_vec has size
> larger than PAGE_SIZE data will just be lost.
>
> Such a situation can occur with I/Os generated from in-kernel sources,
> or with coalesced bio_vecs. This bug was originally reported against
> the pmem driver, where it was found using the Enmotus tiering engine.
>
> Instead we should have brd explicitly tell the block layer that it can
> handle data segments of at most PAGE_SIZE.
>
> Signed-off-by: Ross Zwisler <ross.zwisler@...ux.intel.com>
> Reported-by: Hugh Daschbach <hugh.daschbach@...otus.com>
> Cc: Roger C. Pao (Enmotus) <rcpao.enmotus@...il.com>
> Cc: Boaz Harrosh <boaz@...xistor.com>
> Cc: linux-nvdimm@...ts.01.org
> Cc: Nick Piggin <npiggin@...nel.dk>
> ---
> drivers/block/brd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 898b4f256782..7e4873361b64 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -490,6 +490,7 @@ static struct brd_device *brd_alloc(int i)
> blk_queue_make_request(brd->brd_queue, brd_make_request);
> blk_queue_max_hw_sectors(brd->brd_queue, 1024);
> blk_queue_bounce_limit(brd->brd_queue, BLK_BOUNCE_ANY);
> + blk_queue_max_segment_size(brd->brd_queue, PAGE_SIZE);
The block layer only honors this for request-based drivers. I think
we should just fix it properly. Especially when we have in-kernel
users of persistent memory allowing > PAGE_SIZE segments will be a
nice feature.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists