kernel BUG at scsi_merge.c:83
Subsystems (2)
PATCH 1/1 kernel BUG at scsi_merge.c:83
Hi!
While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The problem is that scsi_alloc_sgtable fails because the request contains too many physical segments. I think this patch is the correct fix:
drivers/scsi/scsi.c +0 -5
@@ -201,11 +201,6 @@/* Hardware imposed limit. */ blk_queue_max_hw_segments (q, SHpnt->sg_tablesize); -/* -* When we remove scsi_malloc soonish, this can die too -*/ -blk_queue_max_phys_segments (q,PAGE_SIZE /sizeof (struct scatterlist )); -blk_queue_max_sectors (q, SHpnt->max_sectors);if (!SHpnt->use_clustering)
Signature · 2 lines
Peter Osterlund - [email protected] http://w1.894.telia.com/~u89404340
Quoted 6 lines · Peter Osterlund
Hi!
While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The problem is that
scsi_alloc_sgtablefails because the request contains too many physical segments. I think this patch is the correct fix:
Correct, ll_rw_blk default is ok now. I missed this when killing scsi_malloc/scsi_dma, thanks.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Peter Osterlund
Hi!
While doing some stress testing on the 2.5.2-pre5 kernel, I am hitting a kernel BUG at scsi_merge.c:83, followed by a kernel panic. The problem is that
scsi_alloc_sgtablefails because the request contains too many physical segments. I think this patch is the correct fix:Correct,
ll_rw_blkdefault is ok now. I missed this when killing scsi_malloc/scsi_dma, thanks.
It turns out this is still not enough to fix the problem for me, because ll_new_hw_segment is still allowing nr_phys_segments to become too large. Is the following patch the correct way to deal with this problem, or is that case supposed to be prevented by some other means? At least, this patch prevents the kernel panic during my stress test.
drivers/block/ll_rw_blk.c +9 -1
@@ -530,6 +530,7 @@ struct bio *bio) {int nr_hw_segs =bio_hw_segments (q, bio); +int nr_phys_segs;if (req->nr_hw_segments + nr_hw_segs > q->max_hw_segments) { req->flags |=REQ_NOMERGE ;
@@ -537,12 +538,19 @@return 0 ; } + nr_phys_segs =bio_phys_segments (q, bio); +if (req->nr_phys_segments + nr_phys_segs > q->max_phys_segments) { + req->flags |=REQ_NOMERGE ; + q->last_merge =NULL ; +return 0 ; + } +/* * This will form the start of a new hw segment. Bump both * counters. */ req->nr_hw_segments += nr_hw_segs; - req->nr_phys_segments +=bio_phys_segments (q, bio); + req->nr_phys_segments += nr_phys_segs;return 1 ; }
Signature · 2 lines
Peter Osterlund - [email protected] http://w1.894.telia.com/~u89404340