• B
    [PATCH] block: CFQ refcounting fix · 38f18527
    Brian King 提交于
    I ran across a memory leak related to the cfq scheduler. The cfq
    init function increments the refcnt of the associated request_queue.
    
    This refcount gets decremented in cfq's exit function. Since blk_cleanup_queue
    only calls the elevator exit function when its refcnt goes to zero, the
    request_q never gets cleaned up. It didn't look like other io schedulers were
    incrementing this refcnt, so I removed the refcnt increment and it fixed the
    memory leak for me.
    
    To reproduce the problem, simply use cfq and use the scsi_host scan sysfs
    attribute to scan "- - -" repeatedly on a scsi host and watch the memory
    vanish.
    Signed-off-by: NBrian King <brking@us.ibm.com>
    Acked-by: NJens Axboe <axboe@suse.de>
    Signed-off-by: NAndrew Morton <akpm@osdl.org>
    Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
    38f18527
cfq-iosched.c 62.3 KB