Revert to Fedora kernel-2.6.17-1.2187_FC5 patched with vs2.0.2.1; there are too many...
[linux-2.6.git] / block / elevator.c
index 8ed2846..7be96bb 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/blkdev.h>
 #include <linux/elevator.h>
 #include <linux/bio.h>
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/init.h>
@@ -850,9 +851,12 @@ fail_register:
         * one again (along with re-adding the sysfs dir)
         */
        elevator_exit(e);
+       e = NULL;
        q->elevator = old_elevator;
        elv_register_queue(q);
        clear_bit(QUEUE_FLAG_ELVSWITCH, &q->queue_flags);
+       if (e)
+               kobject_put(&e->kobj);
        return 0;
 }
 
@@ -892,7 +896,7 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
        struct list_head *entry;
        int len = 0;
 
-       spin_lock_irq(&elv_list_lock);
+       spin_lock_irq(q->queue_lock);
        list_for_each(entry, &elv_list) {
                struct elevator_type *__e;
 
@@ -902,7 +906,7 @@ ssize_t elv_iosched_show(request_queue_t *q, char *name)
                else
                        len += sprintf(name+len, "%s ", __e->elevator_name);
        }
-       spin_unlock_irq(&elv_list_lock);
+       spin_unlock_irq(q->queue_lock);
 
        len += sprintf(len+name, "\n");
        return len;