block: Fix io_context leak after clone with CLONE_IO
authorLouis Rilling <louis.rilling@kerlabs.com>
Fri, 4 Dec 2009 13:52:41 +0000 (14:52 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 4 Dec 2009 15:36:18 +0000 (16:36 +0100)
With CLONE_IO, copy_io() increments both ioc->refcount and ioc->nr_tasks.
However exit_io_context() only decrements ioc->refcount if ioc->nr_tasks
reaches 0.

Always call put_io_context() in exit_io_context().

Signed-off-by: Louis Rilling <louis.rilling@kerlabs.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
block/blk-ioc.c

index d4ed6000147d11221c72cc45322d4c6ea6c68d74..dcd041290b28bbc4f2cb1ac0389cf9a0316d1582 100644 (file)
@@ -80,8 +80,8 @@ void exit_io_context(void)
                        ioc->aic->exit(ioc->aic);
                cfq_exit(ioc);
 
-               put_io_context(ioc);
        }
+       put_io_context(ioc);
 }
 
 struct io_context *alloc_io_context(gfp_t gfp_flags, int node)