All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/1] Fix warning in 2.6.31-rc1 triggered by FC pass-through code
@ 2009-06-26 14:30 Christof Schmitt
  2009-06-26 14:30 ` [patch 1/1] FC transport: Locking fix for common-code FC pass-through patch Christof Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Christof Schmitt @ 2009-06-26 14:30 UTC (permalink / raw)
  To: James Bottomley, James Smart
  Cc: linux-scsi, linux-s390, schwidefsky, heiko.carstens

The FC pass-through code triggers a warning in the block layer
because __blk_run_queue is called with interrupts enabled, but this
function requires being called with disabled interrupts. This patch
fixes this by disabling interrupts in fc_bsg_goose_queue.

--
Christof Schmitt

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch 1/1] FC transport: Locking fix for common-code FC pass-through patch
  2009-06-26 14:30 [patch 0/1] Fix warning in 2.6.31-rc1 triggered by FC pass-through code Christof Schmitt
@ 2009-06-26 14:30 ` Christof Schmitt
  2009-06-26 15:19   ` James Smart
  0 siblings, 1 reply; 3+ messages in thread
From: Christof Schmitt @ 2009-06-26 14:30 UTC (permalink / raw)
  To: James Bottomley, James Smart
  Cc: linux-scsi, linux-s390, schwidefsky, heiko.carstens, Christof Schmitt

[-- Attachment #1: 700-fc-locking.diff --]
[-- Type: text/plain, Size: 3110 bytes --]

From: Christof Schmitt <christof.schmitt@de.ibm.com>

Fix this:
------------[ cut here ]------------
Badness at block/blk-core.c:244
CPU: 0 Tainted: G        W  2.6.31-rc1-00004-gd3a263a #3
Process zfcp_wq (pid: 901, task: 000000002fb7a038, ksp: 000000002f02bc78)
Krnl PSW : 0704300180000000 00000000002141ba (blk_remove_plug+0xb2/0xb8)
           R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:3 PM:0 EA:3
Krnl GPRS: 0000000000000001 0000000000000001 0000000022811440 0000000022811798
           000000000027ff4e 0000000000000000 0000000000000000 000000002f00f000
           070000000006a0f4 000000002af70000 000000002af2a800 00000000228d1c00
           0000000022811440 000000000050c708 000000002f02bca8 000000002f02bc80
Krnl Code: 00000000002141b0: b9140022		lgfr	%r2,%r2
           00000000002141b4: 07fe		bcr	15,%r14
           00000000002141b6: a7f40001		brc	15,2141b8
          >00000000002141ba: a7f4ffbe		brc	15,214136
           00000000002141be: 0707		bcr	0,%r7
           00000000002141c0: ebaff0680024	stmg %r10,%r15,104(%r15)
           00000000002141c6: c0d00017c2a9	larl	%r13,50c718
           00000000002141cc: a7f13fc0		tmll	%r15,16320
Call Trace:
([<000000000050e7d8>] C.272.16122+0x88/0x110)
 [<00000000002141ec>] __blk_run_queue+0x2c/0x154
 [<000000000028013a>] fc_remote_port_add+0x85e/0x95c
 [<000000000037596e>] zfcp_scsi_rport_work+0xe6/0x148
 [<000000000006908c>] worker_thread+0x25c/0x318
 [<000000000006f10c>] kthread+0x94/0x9c
 [<000000000001c2b2>] kernel_thread_starter+0x6/0xc
 [<000000000001c2ac>] kernel_thread_starter+0x0/0xc
INFO: lockdep is turned off.
Last Breaking-Event-Address:
 [<00000000002141b6>] blk_remove_plug+0xae/0xb8

The FC pass-through support triggers the WARN_ON(!irqs_disabled()) in
blk_plug_device. Since blk_plug_device requires being called with
disabled interrupts, use spin_lock_irqsave in fc_bsg_goose_queue to
disable the interrupts before calling into the block layer.

Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
---

 drivers/scsi/scsi_transport_fc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff -urpN linux-2.6/drivers/scsi/scsi_transport_fc.c linux-2.6-patched/drivers/scsi/scsi_transport_fc.c
--- linux-2.6/drivers/scsi/scsi_transport_fc.c	2009-06-26 09:56:55.000000000 +0200
+++ linux-2.6-patched/drivers/scsi/scsi_transport_fc.c	2009-06-26 09:57:06.000000000 +0200
@@ -3670,13 +3670,14 @@ static void
 fc_bsg_goose_queue(struct fc_rport *rport)
 {
 	int flagset;
+	unsigned long flags;
 
 	if (!rport->rqst_q)
 		return;
 
 	get_device(&rport->dev);
 
-	spin_lock(rport->rqst_q->queue_lock);
+	spin_lock_irqsave(rport->rqst_q->queue_lock, flags);
 	flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) &&
 		  !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags);
 	if (flagset)
@@ -3684,7 +3685,7 @@ fc_bsg_goose_queue(struct fc_rport *rpor
 	__blk_run_queue(rport->rqst_q);
 	if (flagset)
 		queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q);
-	spin_unlock(rport->rqst_q->queue_lock);
+	spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags);
 
 	put_device(&rport->dev);
 }


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 1/1] FC transport: Locking fix for common-code FC pass-through patch
  2009-06-26 14:30 ` [patch 1/1] FC transport: Locking fix for common-code FC pass-through patch Christof Schmitt
@ 2009-06-26 15:19   ` James Smart
  0 siblings, 0 replies; 3+ messages in thread
From: James Smart @ 2009-06-26 15:19 UTC (permalink / raw)
  To: Christof Schmitt
  Cc: James Bottomley, linux-scsi, linux-s390, schwidefsky, heiko.carstens

I had tried to remind James that he needed this patch when he pulled in 
the pass-thru code.

Acked-by: James Smart <james.smart@emulex.com>

-- james s

Christof Schmitt wrote:
> From: Christof Schmitt <christof.schmitt@de.ibm.com>
>
> Fix this:
> ------------[ cut here ]------------
> Badness at block/blk-core.c:244
> CPU: 0 Tainted: G        W  2.6.31-rc1-00004-gd3a263a #3
> Process zfcp_wq (pid: 901, task: 000000002fb7a038, ksp: 000000002f02bc78)
> Krnl PSW : 0704300180000000 00000000002141ba (blk_remove_plug+0xb2/0xb8)
>            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:3 PM:0 EA:3
> Krnl GPRS: 0000000000000001 0000000000000001 0000000022811440 0000000022811798
>            000000000027ff4e 0000000000000000 0000000000000000 000000002f00f000
>            070000000006a0f4 000000002af70000 000000002af2a800 00000000228d1c00
>            0000000022811440 000000000050c708 000000002f02bca8 000000002f02bc80
> Krnl Code: 00000000002141b0: b9140022		lgfr	%r2,%r2
>            00000000002141b4: 07fe		bcr	15,%r14
>            00000000002141b6: a7f40001		brc	15,2141b8
>           >00000000002141ba: a7f4ffbe		brc	15,214136
>            00000000002141be: 0707		bcr	0,%r7
>            00000000002141c0: ebaff0680024	stmg %r10,%r15,104(%r15)
>            00000000002141c6: c0d00017c2a9	larl	%r13,50c718
>            00000000002141cc: a7f13fc0		tmll	%r15,16320
> Call Trace:
> ([<000000000050e7d8>] C.272.16122+0x88/0x110)
>  [<00000000002141ec>] __blk_run_queue+0x2c/0x154
>  [<000000000028013a>] fc_remote_port_add+0x85e/0x95c
>  [<000000000037596e>] zfcp_scsi_rport_work+0xe6/0x148
>  [<000000000006908c>] worker_thread+0x25c/0x318
>  [<000000000006f10c>] kthread+0x94/0x9c
>  [<000000000001c2b2>] kernel_thread_starter+0x6/0xc
>  [<000000000001c2ac>] kernel_thread_starter+0x0/0xc
> INFO: lockdep is turned off.
> Last Breaking-Event-Address:
>  [<00000000002141b6>] blk_remove_plug+0xae/0xb8
>
> The FC pass-through support triggers the WARN_ON(!irqs_disabled()) in
> blk_plug_device. Since blk_plug_device requires being called with
> disabled interrupts, use spin_lock_irqsave in fc_bsg_goose_queue to
> disable the interrupts before calling into the block layer.
>
> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
> ---
>
>  drivers/scsi/scsi_transport_fc.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff -urpN linux-2.6/drivers/scsi/scsi_transport_fc.c linux-2.6-patched/drivers/scsi/scsi_transport_fc.c
> --- linux-2.6/drivers/scsi/scsi_transport_fc.c	2009-06-26 09:56:55.000000000 +0200
> +++ linux-2.6-patched/drivers/scsi/scsi_transport_fc.c	2009-06-26 09:57:06.000000000 +0200
> @@ -3670,13 +3670,14 @@ static void
>  fc_bsg_goose_queue(struct fc_rport *rport)
>  {
>  	int flagset;
> +	unsigned long flags;
>  
>  	if (!rport->rqst_q)
>  		return;
>  
>  	get_device(&rport->dev);
>  
> -	spin_lock(rport->rqst_q->queue_lock);
> +	spin_lock_irqsave(rport->rqst_q->queue_lock, flags);
>  	flagset = test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags) &&
>  		  !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags);
>  	if (flagset)
> @@ -3684,7 +3685,7 @@ fc_bsg_goose_queue(struct fc_rport *rpor
>  	__blk_run_queue(rport->rqst_q);
>  	if (flagset)
>  		queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q);
> -	spin_unlock(rport->rqst_q->queue_lock);
> +	spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags);
>  
>  	put_device(&rport->dev);
>  }
>
>
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-06-26 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-26 14:30 [patch 0/1] Fix warning in 2.6.31-rc1 triggered by FC pass-through code Christof Schmitt
2009-06-26 14:30 ` [patch 1/1] FC transport: Locking fix for common-code FC pass-through patch Christof Schmitt
2009-06-26 15:19   ` James Smart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.