[Devel] [PATCH] ploop: don't forget to dec preq->io_count on a error path

Andrei Vagin avagin at virtuozzo.com
Sat Mar 3 02:15:00 MSK 2018


On Thu, Mar 01, 2018 at 01:19:10PM +0300, Vasily Averin wrote:
> Andrey,
> please take look at comment below.
> 
> On 2018-02-15 04:27, Andrei Vagin wrote:
> > [This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]
> > 
> > preq->io_count is incrimented before calling aio_kernel_submit()
> > and it is decrimented in kaio_rw_aio_complete().
> > 
> > But if aio_kernel_submit() failed , preq->io_count has to be decrimented
> > before exiting from the function.
> > ---
> >  drivers/block/ploop/io_kaio.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
> > index 2e48d13..6d922f5 100644
> > --- a/drivers/block/ploop/io_kaio.c
> > +++ b/drivers/block/ploop/io_kaio.c
> > @@ -686,6 +686,7 @@ kaio_io_page(struct ploop_io * io, int op, struct ploop_request * preq,
> >                        err, (op == IOCB_CMD_WRITE_ITER) ? "WRITE" : "READ",
> >                        preq->eng_state, preq->state, pos);
> >                 PLOOP_REQ_SET_ERROR(preq, err);
> > +               ploop_complete_io_request(preq);
> 
> Kostja pointed me this patch for vz6.
> 
> vz6 seems is affected too,
> however I think it's better to use atomic_dec(&preq->io_count) here:
> it should balance atomic_inc called before aio_kernel_submit()
> and should not double ploop_complete_io_request called below.

There is nothing bad to call ploop_complete_io_request() twice. In a
success case, this reference is dropped by kaio_rw_kreq_complete(),
which calls ploop_complete_io_request() too.

> 
> How do you think?
> 
> >         }
> > 
> >  out:
> > --
> > 1.8.3.1
> > 
> > 
> > _______________________________________________
> > Devel mailing list
> > Devel at openvz.org
> > https://lists.openvz.org/mailman/listinfo/devel
> > 


More information about the Devel mailing list