Commit 1ffb96c5 authored by Thibaut VARENE's avatar Thibaut VARENE Committed by Jens Axboe

make elv_register() output atomic

Booting 2.6.21-rc3-g45592145 I noticed the following on one of my
machines in the bootlog:

io scheduler noop registered<6>Time: jiffies clocksource has been installed.

io scheduler deadline registered (default)

Looking at block/elevator.c, it appears that elv_register() uses two
consecutive printks in a non-atomic way, leading to the above glitch. The
attached trivial patch fixes this issue, by using a single printk.
Signed-off-by: default avatarThibaut VARENE <varenet@parisc-linux.org>
Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
parent f772b3d9
...@@ -964,17 +964,18 @@ void elv_unregister_queue(struct request_queue *q) ...@@ -964,17 +964,18 @@ void elv_unregister_queue(struct request_queue *q)
int elv_register(struct elevator_type *e) int elv_register(struct elevator_type *e)
{ {
char *def = "";
spin_lock_irq(&elv_list_lock); spin_lock_irq(&elv_list_lock);
BUG_ON(elevator_find(e->elevator_name)); BUG_ON(elevator_find(e->elevator_name));
list_add_tail(&e->list, &elv_list); list_add_tail(&e->list, &elv_list);
spin_unlock_irq(&elv_list_lock); spin_unlock_irq(&elv_list_lock);
printk(KERN_INFO "io scheduler %s registered", e->elevator_name);
if (!strcmp(e->elevator_name, chosen_elevator) || if (!strcmp(e->elevator_name, chosen_elevator) ||
(!*chosen_elevator && (!*chosen_elevator &&
!strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED))) !strcmp(e->elevator_name, CONFIG_DEFAULT_IOSCHED)))
printk(" (default)"); def = " (default)";
printk("\n");
printk(KERN_INFO "io scheduler %s registered%s\n", e->elevator_name, def);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(elv_register); EXPORT_SYMBOL_GPL(elv_register);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment