Jianpeng Ma
a6ad83fce0
elevator: Fix a race in elevator switching
...
commit d50235b7bc3ee0a0427984d763ea7534149531b4 upstream.
There's a race between elevator switching and normal io operation.
Because the allocation of struct elevator_queue and struct elevator_data
don't in a atomic operation.So there are have chance to use NULL
->elevator_data.
For example:
Thread A: Thread B
blk_queu_bio elevator_switch
spin_lock_irq(q->queue_block) elevator_alloc
elv_merge elevator_init_fn
Because call elevator_alloc, it can't hold queue_lock and the
->elevator_data is NULL.So at the same time, threadA call elv_merge and
nedd some info of elevator_data.So the crash happened.
Move the elevator_alloc into func elevator_init_fn, it make the
operations in a atomic operation.
Using the follow method can easy reproduce this bug
1:dd if=/dev/sdb of=/dev/null
2:while true;do echo noop > scheduler;echo deadline > scheduler;done
The test method also use this method.
Signed-off-by: Jianpeng Ma <majianpeng@gmail.com >
Signed-off-by: Jens Axboe <axboe@kernel.dk >
Cc: Jonghwan Choi <jhbird.choi@samsung.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2013-08-20 08:43:03 -07:00
..
2013-05-17 14:31:05 -04:00
2013-07-13 11:42:26 -07:00
2013-05-04 12:31:18 -07:00
2013-07-25 14:07:23 -07:00
2013-05-05 17:36:20 -07:00
2013-05-17 00:42:33 +02:00
2013-05-11 16:12:44 -07:00
2013-05-06 15:41:42 -07:00
2013-05-09 10:15:46 -07:00
2013-04-29 20:09:03 +02:00
2013-05-14 13:40:45 +02:00
2013-05-25 20:30:31 -07:00
2013-04-28 02:13:43 +01:00
2013-05-13 18:27:18 +04:00
2013-08-14 22:59:08 -07:00
2013-05-16 17:32:21 -07:00
2013-05-14 10:23:57 +05:30
2013-04-30 15:21:02 -07:00
2013-05-30 10:51:20 -07:00
2013-05-07 19:46:02 -07:00
2013-05-07 22:27:15 -04:00
2013-04-29 15:40:23 -04:00
2013-05-08 10:13:35 -07:00
2013-05-08 10:13:35 -07:00
2013-04-29 15:54:39 -07:00
2013-05-15 14:42:15 -07:00
2013-05-01 08:04:12 -07:00
2013-07-21 18:21:25 -07:00
2013-04-30 17:04:01 -07:00
2013-04-30 15:21:02 -07:00
2013-05-02 09:03:55 -07:00
2013-05-09 13:46:38 -04:00
2013-04-29 18:28:13 -07:00
2013-04-29 18:28:13 -07:00
2013-05-31 11:32:30 +02:00
2013-07-25 14:07:42 -07:00
2013-06-12 16:29:44 -07:00
2013-05-11 15:23:17 -07:00
2013-05-01 17:51:54 -07:00
2013-04-29 18:28:19 -07:00
2013-04-29 15:54:27 -07:00
2013-05-10 14:37:17 +01:00
2013-05-01 13:20:04 -07:00
2013-05-01 16:36:22 +05:30
2013-05-02 21:52:26 +05:30
2013-04-30 17:04:02 -07:00
2013-07-28 16:30:11 -07:00
2013-04-30 16:03:10 +01:00
2013-08-20 08:43:03 -07:00
2013-05-07 18:38:27 -07:00
2013-04-29 18:28:40 -07:00
2013-05-01 17:31:42 -04:00
2013-06-10 22:23:32 -07:00
2013-08-04 16:50:38 +08:00
2013-04-30 17:04:00 -07:00
2013-06-20 19:02:45 +04:00
2013-04-29 18:28:41 -07:00
2013-08-14 22:59:07 -07:00
2013-05-09 20:10:22 -04:00
2013-04-29 18:28:13 -07:00
2013-04-30 10:09:06 +02:00
2013-05-06 13:07:33 +02:00
2013-04-29 15:54:38 -07:00
2013-07-13 11:42:26 -07:00
2013-04-29 15:54:26 -07:00
2013-04-29 13:54:36 -04:00
2013-05-08 11:51:05 -07:00
2013-06-12 00:56:27 -07:00
2013-07-28 16:30:05 -07:00
2013-05-02 12:10:19 +02:00
2013-04-29 15:54:37 -07:00
2013-05-01 08:12:58 -07:00
2013-04-25 15:25:23 +02:00
2013-05-13 09:45:01 -04:00
2013-04-29 15:42:02 -04:00
2013-05-24 16:22:51 -07:00
2013-04-30 17:04:06 -07:00
2013-05-16 07:55:07 -07:00
2013-04-30 17:04:02 -07:00
2013-05-31 11:32:30 +02:00
2013-05-05 10:58:06 -07:00
2013-05-31 17:31:52 -07:00
2013-06-12 16:29:47 -07:00
2013-04-29 15:54:37 -07:00
2013-04-30 17:04:00 -07:00
2013-05-07 18:38:26 -07:00
2013-04-30 09:36:50 -07:00
2013-07-21 18:21:29 -07:00
2013-04-29 18:28:44 -07:00
2013-05-02 07:34:58 -07:00
2013-06-26 13:42:54 -07:00
2013-05-23 11:58:55 +02:00
2013-05-01 15:00:24 -04:00
2013-05-06 17:24:22 -04:00
2013-04-29 15:54:36 -07:00
2013-05-04 14:47:26 -04:00
2013-05-08 09:55:05 -04:00
2013-05-02 21:50:38 +05:30
2013-05-07 11:22:14 -07:00
2013-04-29 15:54:28 -07:00
2013-05-02 07:32:24 -07:00
2013-05-17 14:12:06 -06:00
2013-05-01 14:08:52 -07:00
2013-05-28 11:05:08 +02:00
2013-05-07 20:16:25 -07:00
2013-05-05 13:23:27 -07:00
2013-06-19 12:55:10 +02:00
2013-05-22 01:34:24 +02:00
2013-05-01 17:29:47 -04:00
2013-05-01 17:29:39 -04:00
2013-04-29 15:54:28 -07:00
2013-05-07 18:38:27 -07:00
2013-06-02 20:53:59 -07:00
2013-05-28 22:47:13 -04:00
2013-05-28 22:47:13 -04:00
2013-08-14 22:59:06 -07:00
2013-04-30 17:04:09 -07:00
2013-04-29 19:14:20 -07:00
2013-05-24 16:22:50 -07:00
2013-05-24 16:22:50 -07:00
2013-04-29 18:28:22 -07:00
2013-05-30 09:20:20 +02:00
2013-08-20 08:43:02 -07:00
2013-04-30 16:27:51 -07:00
2013-05-01 17:51:54 -07:00
2013-06-25 16:07:44 -07:00
2013-05-06 09:24:16 +03:00
2013-06-14 19:24:42 -10:00
2013-04-29 13:21:30 -04:00
2013-06-06 11:52:14 -07:00
2013-06-20 19:02:45 +04:00
2013-04-30 17:04:03 -07:00
2013-04-30 15:50:12 +05:30
2013-04-29 15:54:38 -07:00
2013-06-12 16:29:46 -07:00
2013-08-20 08:43:02 -07:00
2013-06-12 16:29:44 -07:00
2013-05-09 09:40:49 -07:00
2013-08-11 18:35:24 -07:00
2013-05-14 20:54:06 +02:00
2013-04-25 21:01:45 +08:00
2013-06-10 13:37:10 -07:00
2013-05-11 14:29:11 -07:00
2013-05-20 10:24:22 +09:30
2013-08-11 18:35:25 -07:00
2013-07-28 16:29:55 -07:00
2013-04-29 15:54:34 -07:00
2013-04-29 15:54:38 -07:00
2013-04-29 15:54:37 -07:00
2013-05-20 12:15:59 -07:00
2013-05-31 11:31:50 +02:00
2013-05-24 16:22:50 -07:00
2013-04-30 17:04:02 -07:00
2013-05-07 20:16:25 -07:00