> -----Original Message----- > From: Javier González [mailto:javier@xxxxxxxxxxx] > Sent: Thursday, January 31, 2019 12:02 AM > To: Matias Bjørling <mb@xxxxxxxxxxx> > Cc: chansol.kim@xxxxxxxxxxx; linux-block@xxxxxxxxxxxxxxx; Matias Bjorling <matias.bjorling@xxxxxxx> > Subject: Re: [PATCH] lightnvm: pblk: fix bio leak on large sized io > > > > On 30 Jan 2019, at 15.06, Matias Bjørling <mb@xxxxxxxxxxx> wrote: > > > > On 1/30/19 2:53 AM, 김찬솔 wrote: > >> Changes: > >> 1. Function pblk_rw_io to get bio* as a reference 2. In pblk_rw_io > >> bio_put call on read case removed A fix to address issue where 1. > >> pblk_make_rq calls pblk_rw_io passes bio* pointer as a value (0xA) > >> 2. pblk_rw_io calls blk_queue_split passing bio* pointer as reference > >> 3. In blk_queue_split, when there is a split, the original bio* (0xA) > >> is passed to generic_make_requests, and the newly allocated bio is > >> returned > >> 4. If NVM_IO_DONE returned, pblk_make_rq calls bio_endio on the bio*, > >> that is not the one returned by blk_queue_split 5. As a result > >> bio_endio is not called on the newly allocated bio. > > > > The commit message needs a bit of massaging. The Changes: paragraph is not needed (that is what the > patch is for). Also, please redo the second paragraph in without the bullets. > > Thank you for comment, I will format it better. > >> Signed-off-by: chansol.kim <chansol.kim@xxxxxxxxxxx> > >> --- > >> drivers/lightnvm/pblk-init.c | 22 ++++++++-------------- > >> 1 file changed, 8 insertions(+), 14 deletions(-) diff --git > >> a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index > >> b57f764d..4efc929 100644 > >> --- a/drivers/lightnvm/pblk-init.c > >> +++ b/drivers/lightnvm/pblk-init.c > >> @@ -31,30 +31,24 @@ static DECLARE_RWSEM(pblk_lock); struct bio_set > >> pblk_bio_set; > >> static int pblk_rw_io(struct request_queue *q, struct pblk *pblk, > >> - struct bio *bio) > >> + struct bio **bio) > > > > I am not sure why the **bio change is needed. Can you elaborate? > > bio_split creates a new bio and queues the original one again. If the reference is not updated then > the newly created bio is never freed when NVM_IO_DONE is returned to pblk_make_rq(), thus resulting on > a leak. > > Javier Thank you Javier for the explanation. Dear Matias, please review whether the above change is acceptabl. If further change is required, I will address that and include the above commit log amend along with it. Thank you. Regards, Chansol Kim