diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/elevator.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/block/elevator.c b/block/elevator.c index 205b09a5bd9e..4e11559aa2b0 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -938,6 +938,7 @@ int elv_register_queue(struct request_queue *q) | |||
938 | } | 938 | } |
939 | } | 939 | } |
940 | kobject_uevent(&e->kobj, KOBJ_ADD); | 940 | kobject_uevent(&e->kobj, KOBJ_ADD); |
941 | e->registered = 1; | ||
941 | } | 942 | } |
942 | return error; | 943 | return error; |
943 | } | 944 | } |
@@ -947,6 +948,7 @@ static void __elv_unregister_queue(struct elevator_queue *e) | |||
947 | { | 948 | { |
948 | kobject_uevent(&e->kobj, KOBJ_REMOVE); | 949 | kobject_uevent(&e->kobj, KOBJ_REMOVE); |
949 | kobject_del(&e->kobj); | 950 | kobject_del(&e->kobj); |
951 | e->registered = 0; | ||
950 | } | 952 | } |
951 | 953 | ||
952 | void elv_unregister_queue(struct request_queue *q) | 954 | void elv_unregister_queue(struct request_queue *q) |
@@ -1042,11 +1044,13 @@ static int elevator_switch(struct request_queue *q, struct elevator_type *new_e) | |||
1042 | 1044 | ||
1043 | spin_unlock_irq(q->queue_lock); | 1045 | spin_unlock_irq(q->queue_lock); |
1044 | 1046 | ||
1045 | __elv_unregister_queue(old_elevator); | 1047 | if (old_elevator->registered) { |
1048 | __elv_unregister_queue(old_elevator); | ||
1046 | 1049 | ||
1047 | err = elv_register_queue(q); | 1050 | err = elv_register_queue(q); |
1048 | if (err) | 1051 | if (err) |
1049 | goto fail_register; | 1052 | goto fail_register; |
1053 | } | ||
1050 | 1054 | ||
1051 | /* | 1055 | /* |
1052 | * finally exit old elevator and turn off BYPASS. | 1056 | * finally exit old elevator and turn off BYPASS. |