diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-07 13:54:56 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-07 13:54:56 -0700 |
commit | c8d86d8ac439ef6c9364bf0ba3a05a3f9a8e0dea (patch) | |
tree | f09a1c627ac9b44dade9a5f6f10a8e9dfc86a9b2 | |
parent | 74de82ed1e49d9c7af84c3beb3759316854f54ed (diff) | |
parent | 430c62fb2948d964cf8dc7f3e2f69623c04ef62f (diff) | |
download | linux-exynos-c8d86d8ac439ef6c9364bf0ba3a05a3f9a8e0dea.tar.gz linux-exynos-c8d86d8ac439ef6c9364bf0ba3a05a3f9a8e0dea.tar.bz2 linux-exynos-c8d86d8ac439ef6c9364bf0ba3a05a3f9a8e0dea.zip |
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
elevator: fix oops on early call to elevator_change()
-rw-r--r-- | block/elevator.c | 12 | ||||
-rw-r--r-- | include/linux/elevator.h | 1 |
2 files changed, 9 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) } } kobject_uevent(&e->kobj, KOBJ_ADD); + e->registered = 1; } return error; } @@ -947,6 +948,7 @@ static void __elv_unregister_queue(struct elevator_queue *e) { kobject_uevent(&e->kobj, KOBJ_REMOVE); kobject_del(&e->kobj); + e->registered = 0; } 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) spin_unlock_irq(q->queue_lock); - __elv_unregister_queue(old_elevator); + if (old_elevator->registered) { + __elv_unregister_queue(old_elevator); - err = elv_register_queue(q); - if (err) - goto fail_register; + err = elv_register_queue(q); + if (err) + goto fail_register; + } /* * finally exit old elevator and turn off BYPASS. diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 926b50322a46..4fd978e7eb83 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -93,6 +93,7 @@ struct elevator_queue struct elevator_type *elevator_type; struct mutex sysfs_lock; struct hlist_head *hash; + unsigned int registered:1; }; /* |