diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 13:21:20 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-03-18 18:34:12 -0500 |
commit | e17a9489b4a686bb5e9615e1d375c67619cb99c5 (patch) | |
tree | e6574d24ad8f16fefe7663c91cf19109e48f8c6c /block/elevator.c | |
parent | 25975f863b0fd42c58109e253e7a4c65d9fdaf48 (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.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/block/elevator.c b/block/elevator.c index 24b702d649a..0232df2b16e 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -675,21 +675,15 @@ void elv_unregister(struct elevator_type *e) /* * Iterate every thread in the process to remove the io contexts. */ - read_lock(&tasklist_lock); - do_each_thread(g, p) { - struct io_context *ioc = p->io_context; - if (ioc && ioc->cic) { - ioc->cic->exit(ioc->cic); - ioc->cic->dtor(ioc->cic); - ioc->cic = NULL; - } - if (ioc && ioc->aic) { - ioc->aic->exit(ioc->aic); - ioc->aic->dtor(ioc->aic); - ioc->aic = NULL; - } - } while_each_thread(g, p); - read_unlock(&tasklist_lock); + if (e->ops.trim) { + read_lock(&tasklist_lock); + do_each_thread(g, p) { + task_lock(p); + e->ops.trim(p->io_context); + task_unlock(p); + } while_each_thread(g, p); + read_unlock(&tasklist_lock); + } spin_lock_irq(&elv_list_lock); list_del_init(&e->list); |