Re: [PATCH v2 1/6] zram: handle multiple pages attached bio's bvec

From: Minchan Kim
Date: Thu Apr 13 2017 - 09:41:15 EST


Hi Johannes,

On Thu, Apr 13, 2017 at 09:15:00AM +0200, Johannes Thumshirn wrote:
> On Thu, Apr 13, 2017 at 11:59:20AM +0900, Minchan Kim wrote:
> > Johannes Thumshirn reported system goes the panic when using NVMe over
> > Fabrics loopback target with zram.
> >
> > The reason is zram expects each bvec in bio contains a single page
> > but nvme can attach a huge bulk of pages attached to the bio's bvec
> > so that zram's index arithmetic could be wrong so that out-of-bound
> > access makes system panic.
> >
> > [1] in mainline solved solved the problem by limiting max_sectors with
> > SECTORS_PER_PAGE but it makes zram slow because bio should split with
> > each pages so this patch makes zram aware of multiple pages in a bvec
> > so it could solve without any regression(ie, bio split).
> >
> > [1] 0bc315381fe9, zram: set physical queue limits to avoid array out of
> > bounds accesses
> >
> > * from v1
> > * Do not exceed page boundary when set up bv.bv_len in make_request
> > * change "remained" variable name with "unwritten"
> >
> > Cc: Hannes Reinecke <hare@xxxxxxxx>
> > Reported-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
> > Tested-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
> > Reviewed-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
> > Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx>
> > Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
> > ---
>
> Hi Minchan,
>
> A quick amendment to your patch you forgot to remove the queue limit
> setting which I introduced with commit 0bc315381fe9.

It was my mistake. I made patches with reverting 0bc315381fe9.
Thanks for the review!

I think it is convenient to resend just this one for Andrew.
Andrew, Please take this as [1/6]. Sorry for the confusion.