[PATCH] stop elv_unregister() from rogering other iosched's data, fix locking
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/block/as-iosched.c b/block/as-iosched.c
index 8da3cf6..d2ee2af 100644
--- a/block/as-iosched.c
+++ b/block/as-iosched.c
@@ -195,6 +195,12 @@
kfree(aic);
}
+static void as_trim(struct io_context *ioc)
+{
+ kfree(ioc->aic);
+ ioc->aic = NULL;
+}
+
/* Called when the task exits */
static void exit_as_io_context(struct as_io_context *aic)
{
@@ -1860,6 +1866,7 @@
.elevator_may_queue_fn = as_may_queue,
.elevator_init_fn = as_init_queue,
.elevator_exit_fn = as_exit_queue,
+ .trim = as_trim,
},
.elevator_ktype = &as_ktype,