aboutsummaryrefslogtreecommitdiffstats
path: root/block/elevator.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-03-18 13:21:20 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2006-03-18 18:34:12 -0500
commite17a9489b4a686bb5e9615e1d375c67619cb99c5 (patch)
treee6574d24ad8f16fefe7663c91cf19109e48f8c6c /block/elevator.c
parent25975f863b0fd42c58109e253e7a4c65d9fdaf48 (diff)
[PATCH] stop elv_unregister() from rogering other iosched's data, fix locking
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 24b702d649a9..0232df2b16e6 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -675,21 +675,15 @@ void elv_unregister(struct elevator_type *e)
675 /* 675 /*
676 * Iterate every thread in the process to remove the io contexts. 676 * Iterate every thread in the process to remove the io contexts.
677 */ 677 */
678 read_lock(&tasklist_lock); 678 if (e->ops.trim) {
679 do_each_thread(g, p) { 679 read_lock(&tasklist_lock);
680 struct io_context *ioc = p->io_context; 680 do_each_thread(g, p) {
681 if (ioc && ioc->cic) { 681 task_lock(p);
682 ioc->cic->exit(ioc->cic); 682 e->ops.trim(p->io_context);
683 ioc->cic->dtor(ioc->cic); 683 task_unlock(p);
684 ioc->cic = NULL; 684 } while_each_thread(g, p);
685 } 685 read_unlock(&tasklist_lock);
686 if (ioc && ioc->aic) { 686 }
687 ioc->aic->exit(ioc->aic);
688 ioc->aic->dtor(ioc->aic);
689 ioc->aic = NULL;
690 }
691 } while_each_thread(g, p);
692 read_unlock(&tasklist_lock);
693 687
694 spin_lock_irq(&elv_list_lock); 688 spin_lock_irq(&elv_list_lock);
695 list_del_init(&e->list); 689 list_del_init(&e->list);