All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] BLOCK: use disk_stat_add instead of __disk_stat_add in __end_that_request_first
@ 2006-01-21 17:22 Tejun Heo
  2006-01-21 19:46 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2006-01-21 17:22 UTC (permalink / raw)
  To: axboe, linux-kernel

Unlike end_that_request_last, caller is supposed to own the request
when it calls __end_that_request_first and thus allowed to call from
any context without any locking.  When SCSI EH completes requests, it
calls __end_that_request_first from kernel thread context without
holding any lock and none of preemption/bh/irq disabled.  This results
in the following warning.

BUG: using smp_processor_id() in preemptible [00000001] code: scsi_eh_6/927
caller is __end_that_request_first+0xbf/0x500
 [<c01046e3>] show_trace+0x13/0x20
 [<c010470e>] dump_stack+0x1e/0x20
 [<c02231c8>] debug_smp_processor_id+0xa8/0xb0
 [<c021167f>] __end_that_request_first+0xbf/0x500
 [<c0211ad1>] end_that_request_chunk+0x11/0x20
 [<c03360b2>] scsi_end_request+0x32/0x110
-- snip --

This patch makes __end_that_request_first() use undashed
disk_stat_add() which doesn't assume preemption is disabled.

Signed-off-by: Tejun Heo <htejun@gmail.com>

diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index 8e27d0a..eb0473b 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -3153,7 +3153,7 @@ static int __end_that_request_first(stru
 	if (blk_fs_request(req) && req->rq_disk) {
 		const int rw = rq_data_dir(req);
 
-		__disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9);
+		disk_stat_add(req->rq_disk, sectors[rw], nr_bytes >> 9);
 	}
 
 	total_bytes = bio_nbytes = 0;

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

* Re: [PATCH] BLOCK: use disk_stat_add instead of __disk_stat_add in __end_that_request_first
  2006-01-21 17:22 [PATCH] BLOCK: use disk_stat_add instead of __disk_stat_add in __end_that_request_first Tejun Heo
@ 2006-01-21 19:46 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2006-01-21 19:46 UTC (permalink / raw)
  To: Tejun Heo; +Cc: linux-kernel

On Sun, Jan 22 2006, Tejun Heo wrote:
> Unlike end_that_request_last, caller is supposed to own the request
> when it calls __end_that_request_first and thus allowed to call from
> any context without any locking.  When SCSI EH completes requests, it
> calls __end_that_request_first from kernel thread context without
> holding any lock and none of preemption/bh/irq disabled.  This results
> in the following warning.
> 
> BUG: using smp_processor_id() in preemptible [00000001] code: scsi_eh_6/927
> caller is __end_that_request_first+0xbf/0x500
>  [<c01046e3>] show_trace+0x13/0x20
>  [<c010470e>] dump_stack+0x1e/0x20
>  [<c02231c8>] debug_smp_processor_id+0xa8/0xb0
>  [<c021167f>] __end_that_request_first+0xbf/0x500
>  [<c0211ad1>] end_that_request_chunk+0x11/0x20
>  [<c03360b2>] scsi_end_request+0x32/0x110
> -- snip --
> 
> This patch makes __end_that_request_first() use undashed
> disk_stat_add() which doesn't assume preemption is disabled.

Patch is good, however I already added this identical patch to the block
git repo last week :-)

-- 
Jens Axboe


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

end of thread, other threads:[~2006-01-21 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-21 17:22 [PATCH] BLOCK: use disk_stat_add instead of __disk_stat_add in __end_that_request_first Tejun Heo
2006-01-21 19:46 ` Jens Axboe

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.