aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/elevator.c
diff options
context:
space:
mode:
authorNate Diller <nate@namesys.com>2005-10-30 18:02:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 20:37:20 -0500
commit2ca7d93bb27876e5fd4ebfcb3b00627107bdad4d (patch)
treedb3dbc868db28f9983ce99911ee7795042fba502 /drivers/block/elevator.c
parent3fa63c7d82ab9a12a5d0a299069f8df9f35aa011 (diff)
[PATCH] block cleanups: Fix iosched module refcount leak
If the requested I/O scheduler is already in place, elevator_switch simply leaves the queue alone, and returns. However, it forgets to call elevator_put, so 'echo [current_sched] > /sys/block/[dev]/queue/scheduler' will leak a reference, causing the current_sched module to be permanently pinned in memory. Signed-off-by: Nate Diller <nate@namesys.com> Acked-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block/elevator.c')
-rw-r--r--drivers/block/elevator.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/elevator.c b/drivers/block/elevator.c
index 3b652eba2d20..36f1057084b0 100644
--- a/drivers/block/elevator.c
+++ b/drivers/block/elevator.c
@@ -753,8 +753,10 @@ ssize_t elv_iosched_store(request_queue_t *q, const char *name, size_t count)
753 return -EINVAL; 753 return -EINVAL;
754 } 754 }
755 755
756 if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) 756 if (!strcmp(elevator_name, q->elevator->elevator_type->elevator_name)) {
757 elevator_put(e);
757 return count; 758 return count;
759 }
758 760
759 elevator_switch(q, e); 761 elevator_switch(q, e);
760 return count; 762 return count;