Bian Yu
905b0297a9
md: avoid deadlock when md_set_badblocks.
...
When operate harddisk and hit errors, md_set_badblocks is called after
scsi_restart_operations which already disabled the irq. but md_set_badblocks
will call write_sequnlock_irq and enable irq. so softirq can preempt the
current thread and that may cause a deadlock. I think this situation should
use write_sequnlock_irqsave/irqrestore instead.
I met the situation and the call trace is below:
[ 638.919974] BUG: spinlock recursion on CPU#0, scsi_eh_13/1010
[ 638.921923] lock: 0xffff8800d4d51fc8, .magic: dead4ead, .owner: scsi_eh_13/1010, .owner_cpu: 0
[ 638.923890] CPU: 0 PID: 1010 Comm: scsi_eh_13 Not tainted 3.12.0-rc5+ #37
[ 638.925844] Hardware name: To be filled by O.E.M. To be filled by O.E.M./MAHOBAY, BIOS 4.6.5 03/05/2013
[ 638.927816] ffff880037ad4640 ffff880118c03d50 ffffffff8172ff85 0000000000000007
[ 638.929829] ffff8800d4d51fc8 ffff880118c03d70 ffffffff81730030 ffff8800d4d51fc8
[ 638.931848] ffffffff81a72eb0 ffff880118c03d90 ffffffff81730056 ffff8800d4d51fc8
[ 638.933884] Call Trace:
[ 638.935867] <IRQ> [<ffffffff8172ff85>] dump_stack+0x55/0x76
[ 638.937878] [<ffffffff81730030>] spin_dump+0x8a/0x8f
[ 638.939861] [<ffffffff81730056>] spin_bug+0x21/0x26
[ 638.941836] [<ffffffff81336de4>] do_raw_spin_lock+0xa4/0xc0
[ 638.943801] [<ffffffff8173f036>] _raw_spin_lock+0x66/0x80
[ 638.945747] [<ffffffff814a73ed>] ? scsi_device_unbusy+0x9d/0xd0
[ 638.947672] [<ffffffff8173fb1b>] ? _raw_spin_unlock+0x2b/0x50
[ 638.949595] [<ffffffff814a73ed>] scsi_device_unbusy+0x9d/0xd0
[ 638.951504] [<ffffffff8149ec47>] scsi_finish_command+0x37/0xe0
[ 638.953388] [<ffffffff814a75e8>] scsi_softirq_done+0xa8/0x140
[ 638.955248] [<ffffffff8130e32b>] blk_done_softirq+0x7b/0x90
[ 638.957116] [<ffffffff8104fddd>] __do_softirq+0xfd/0x330
[ 638.958987] [<ffffffff810b964f>] ? __lock_release+0x6f/0x100
[ 638.960861] [<ffffffff8174a5cc>] call_softirq+0x1c/0x30
[ 638.962724] [<ffffffff81004c7d>] do_softirq+0x8d/0xc0
[ 638.964565] [<ffffffff8105024e>] irq_exit+0x10e/0x150
[ 638.966390] [<ffffffff8174ad4a>] smp_apic_timer_interrupt+0x4a/0x60
[ 638.968223] [<ffffffff817499af>] apic_timer_interrupt+0x6f/0x80
[ 638.970079] <EOI> [<ffffffff810b964f>] ? __lock_release+0x6f/0x100
[ 638.971899] [<ffffffff8173fa6a>] ? _raw_spin_unlock_irq+0x3a/0x50
[ 638.973691] [<ffffffff8173fa60>] ? _raw_spin_unlock_irq+0x30/0x50
[ 638.975475] [<ffffffff81562393>] md_set_badblocks+0x1f3/0x4a0
[ 638.977243] [<ffffffff81566e07>] rdev_set_badblocks+0x27/0x80
[ 638.978988] [<ffffffffa00d97bb>] raid5_end_read_request+0x36b/0x4e0 [raid456]
[ 638.980723] [<ffffffff811b5a1d>] bio_endio+0x1d/0x40
[ 638.982463] [<ffffffff81304ff3>] req_bio_endio.isra.65+0x83/0xa0
[ 638.984214] [<ffffffff81306b9f>] blk_update_request+0x7f/0x350
[ 638.985967] [<ffffffff81306ea1>] blk_update_bidi_request+0x31/0x90
[ 638.987710] [<ffffffff813085e0>] __blk_end_bidi_request+0x20/0x50
[ 638.989439] [<ffffffff8130862f>] __blk_end_request_all+0x1f/0x30
[ 638.991149] [<ffffffff81308746>] blk_peek_request+0x106/0x250
[ 638.992861] [<ffffffff814a62a9>] ? scsi_kill_request.isra.32+0xe9/0x130
[ 638.994561] [<ffffffff814a633a>] scsi_request_fn+0x4a/0x3d0
[ 638.996251] [<ffffffff813040a7>] __blk_run_queue+0x37/0x50
[ 638.997900] [<ffffffff813045af>] blk_run_queue+0x2f/0x50
[ 638.999553] [<ffffffff814a5750>] scsi_run_queue+0xe0/0x1c0
[ 639.001185] [<ffffffff814a7721>] scsi_run_host_queues+0x21/0x40
[ 639.002798] [<ffffffff814a2e87>] scsi_restart_operations+0x177/0x200
[ 639.004391] [<ffffffff814a4fe9>] scsi_error_handler+0xc9/0xe0
[ 639.005996] [<ffffffff814a4f20>] ? scsi_unjam_host+0xd0/0xd0
[ 639.007600] [<ffffffff81072f6b>] kthread+0xdb/0xe0
[ 639.009205] [<ffffffff81072e90>] ? flush_kthread_worker+0x170/0x170
[ 639.010821] [<ffffffff81748cac>] ret_from_fork+0x7c/0xb0
[ 639.012437] [<ffffffff81072e90>] ? flush_kthread_worker+0x170/0x170
This bug was introduce in commit 2e8ac30312973dd20e68073653
(the first time rdev_set_badblock was call from interrupt context),
so this patch is appropriate for 3.5 and subsequent kernels.
Cc: <stable@vger.kernel.org> (3.5+)
Signed-off-by: Bian Yu <bianyu@kedacom.com>
Reviewed-by: Jianpeng Ma <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
2013-10-24 12:57:11 +11:00
..
2013-10-17 15:44:48 +02:00
2013-10-22 08:21:34 +01:00
2013-09-15 22:18:55 -04:00
2013-10-16 18:42:41 -07:00
2013-09-26 14:02:33 -04:00
2013-09-24 17:00:26 -07:00
2013-09-23 17:44:25 -03:00
2013-10-01 17:04:17 +00:00
2013-10-15 16:22:11 -07:00
2013-09-09 15:49:04 -07:00
2013-09-26 02:31:04 +02:00
2013-10-02 16:03:50 -04:00
2013-10-16 23:53:38 +02:00
2013-09-12 11:22:45 -07:00
2013-09-07 12:53:35 +10:00
2013-10-11 07:31:47 +05:30
2013-09-06 11:14:33 -07:00
2013-09-03 11:37:15 -07:00
2013-09-11 15:58:51 -07:00
2013-10-11 16:31:54 +02:00
2013-10-22 07:35:17 +01:00
2013-10-21 13:39:37 +02:00
2013-10-17 09:30:10 -07:00
2013-10-09 09:48:55 -07:00
2013-10-10 10:22:35 +02:00
2013-09-05 15:21:30 -04:00
2013-10-15 19:26:43 +01:00
2013-10-21 09:44:17 -07:00
2013-09-15 07:13:39 -04:00
2013-10-04 10:43:34 -07:00
2013-09-09 16:35:29 -07:00
2013-09-15 22:27:04 -04:00
2013-09-12 11:35:33 -07:00
2013-09-06 08:09:27 +09:30
2013-09-18 12:02:00 -07:00
2013-10-24 12:57:11 +11:00
2013-10-14 06:37:00 -03:00
2013-09-06 13:30:06 -07:00
2013-09-11 15:59:35 -07:00
2013-09-13 15:09:52 +02:00
2013-09-26 13:56:53 -07:00
2013-09-21 09:55:32 -07:00
2013-09-27 05:56:22 -05:00
2013-10-23 07:47:42 +01:00
2013-09-05 11:08:01 -07:00
2013-10-15 09:26:07 +01:00
2013-09-03 22:52:48 -04:00
2013-09-03 16:24:35 -07:00
2013-10-12 01:49:48 +02:00
2013-09-27 16:22:43 +02:00
2013-10-23 07:57:57 +01:00
2013-09-11 15:58:15 -07:00
2013-09-13 15:09:52 +02:00
2013-09-13 15:09:52 +02:00
2013-09-06 13:21:16 -07:00
2013-09-30 12:04:33 +01:00
2013-09-11 15:58:59 -07:00
2013-10-22 09:16:40 +02:00
2013-09-19 13:57:28 -05:00
2013-10-07 14:51:59 +01:00
2013-10-23 07:52:36 +01:00
2013-10-03 14:22:45 -07:00
2013-10-21 11:26:45 +08:00
2013-10-16 13:22:16 -07:00
2013-09-03 11:37:15 -07:00
2013-10-16 13:52:16 -07:00
2013-10-11 10:40:46 -06:00
2013-10-01 21:27:31 -07:00
2013-09-26 15:33:23 +03:00
2013-09-09 10:02:53 +09:30
2013-10-07 00:12:14 -07:00
2013-10-13 20:02:03 +02:00
2013-09-25 15:50:53 -07:00