Aaron Lu
10c580e423
[SCSI] sd: call blk_pm_runtime_init before add_disk
...
Sujit has found a race condition that would make q->nr_pending
unbalanced, it occurs as Sujit explained:
"
sd_probe_async() ->
add_disk() ->
disk_add_event() ->
schedule(disk_events_workfn)
sd_revalidate_disk()
blk_pm_runtime_init()
return;
Let's say the disk_events_workfn() calls sd_check_events() which tries
to send test_unit_ready() and because of sd_revalidate_disk() trying to
send another commands the test_unit_ready() might be re-queued as the
tagged command queuing is disabled.
So the race condition is -
Thread 1 | Thread 2
sd_revalidate_disk() | sd_check_events()
...nr_pending = 0 as q->dev = NULL| scsi_queue_insert()
blk_runtime_pm_init() | blk_pm_requeue_request() ->
| nr_pending = -1 since
| q->dev != NULL
"
The problem is, the test_unit_ready request doesn't get counted the
first time it is queued, so the later decrement of q->nr_pending in
blk_pm_requeue_request makes it unbalanced.
Fix this by calling blk_pm_runtime_init before add_disk so that all
requests initiated there will all be counted.
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Reported-and-tested-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2013-10-23 14:09:18 +01:00
..
2013-07-04 12:30:30 -07:00
2013-09-10 14:48:16 -07:00
2013-05-28 12:02:12 +02:00
2013-06-04 11:15:59 -07:00
2013-04-09 14:13:27 -04:00
2013-07-03 16:07:41 -07:00
2013-09-06 09:36:28 -07:00
2013-09-18 12:24:32 -04:00
2013-09-18 12:24:32 -04:00
2013-06-04 11:16:28 -07:00
2013-08-20 13:06:40 +02:00
2013-04-11 16:00:31 -07:00
2013-09-06 11:22:35 -07:00
2013-07-13 17:41:21 -07:00
2013-09-11 15:59:25 -07:00
2013-09-06 11:41:34 -07:00
2013-08-26 12:51:30 +04:00
2013-07-13 08:22:56 +04:00
2013-06-04 11:15:59 -07:00
2013-09-15 17:41:30 -04:00
2013-09-15 17:41:30 -04:00
2013-09-03 07:27:58 -07:00
2013-09-06 11:42:53 -07:00
2013-07-23 15:23:08 -07:00
2013-07-25 16:34:39 -07:00
2013-04-09 14:13:21 -04:00
2013-09-03 15:48:06 -07:00
2013-10-23 14:09:18 +01:00
2013-09-03 07:27:57 -07:00
2013-04-09 14:13:15 -04:00
2013-09-06 16:08:37 -07:00
2013-02-22 23:31:31 -05:00
2013-02-22 23:31:31 -05:00
2013-06-24 16:32:22 -07:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:15 -04:00
2013-06-24 19:44:18 +02:00
2013-06-24 19:44:18 +02:00
2013-04-09 14:13:22 -04:00
2013-04-09 14:13:22 -04:00
2013-04-09 14:13:23 -04:00
2013-04-09 14:13:28 -04:00
2013-04-09 14:13:29 -04:00
2013-04-09 14:13:29 -04:00
2013-04-09 14:13:29 -04:00
2013-04-09 14:13:24 -04:00
2013-10-16 13:57:14 +01:00
2013-06-26 18:32:47 -07:00
2013-01-03 15:57:01 -08:00
2013-02-27 19:10:18 -08:00
2013-07-09 22:52:29 +01:00
2013-04-09 14:13:24 -04:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:24 -04:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:17 -04:00
2013-09-03 07:27:58 -07:00
2013-08-01 18:08:34 -07:00
2013-08-01 18:08:34 -07:00
2013-01-03 15:57:01 -08:00
2013-06-26 18:32:47 -07:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:15 -04:00
2013-02-06 12:18:56 -08:00
2013-09-15 17:41:30 -04:00
2013-08-26 12:51:31 +04:00
2013-01-03 15:57:01 -08:00
2012-11-27 08:59:43 +04:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:25 -04:00
2013-01-03 15:57:01 -08:00
2013-08-26 12:51:32 +04:00
2013-08-26 12:51:32 +04:00
2013-04-09 14:13:27 -04:00
2013-04-09 14:13:27 -04:00
2013-04-11 16:55:04 -07:00
2013-01-03 15:57:01 -08:00
2013-09-03 15:48:06 -07:00
2013-01-03 15:57:01 -08:00
2013-07-09 18:24:39 -07:00
2013-08-26 18:53:49 +04:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:17 -04:00
2013-09-03 07:27:58 -07:00
2013-06-05 13:49:36 -06:00
2013-04-29 15:41:57 -04:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:15 -04:00
2013-04-15 14:30:44 -06:00
2013-04-15 14:30:44 -06:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:17 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-06-19 17:53:35 +02:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:17 -04:00
2013-06-18 13:48:45 +02:00
2013-04-09 14:13:17 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-09-03 07:28:08 -07:00
2013-06-24 13:00:10 -07:00
2013-08-26 18:52:27 +04:00
2013-09-03 18:19:53 -07:00
2013-03-28 14:27:24 -04:00
2013-06-03 21:49:52 +02:00
2013-05-31 15:16:51 -04:00
2013-06-24 13:00:10 -07:00
2013-08-26 18:52:27 +04:00
2013-07-03 16:07:41 -07:00
2013-08-23 13:08:30 -04:00
2012-12-01 10:08:41 +00:00
2012-11-30 17:40:33 -08:00
2013-08-02 13:20:21 -07:00
2013-05-02 15:37:03 -07:00
2013-10-23 14:09:18 +01:00
2013-06-26 17:56:18 -07:00
2013-09-03 07:28:10 -07:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-05-07 02:16:21 -04:00
2013-08-21 10:10:50 -07:00
2013-01-03 15:57:01 -08:00
2013-08-02 11:34:30 +08:00
2013-05-04 14:50:16 -04:00
2013-05-04 14:50:16 -04:00
2013-05-04 14:50:16 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:17 -04:00
2013-04-09 14:13:17 -04:00
2013-01-03 15:57:01 -08:00
2013-08-01 11:37:19 +09:30
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:15 -04:00
2013-04-09 14:13:15 -04:00
2013-04-09 14:13:15 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00