Skip to contentSkip to conversation

Scsi problems in 2.5.1-pre9

DISCUSSION Paul Larson 4 participants 16 messages Dec 11, 2001 – Dec 12, 2001

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

My hardware is a dual proc PII-300. I was running LTP runalltests.sh and it was on one of the growfiles tests when this problem occurred. The test hung, and I couldn't telnet into the machine or login to it, but I could switch between VC's. On the console, I had screenfulls of errors like this:

Incorrect number of segments after building list
counted 11, received 7
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 14, received 10
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 13, received 11
req nr_sec 584, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
(scsi0:A:5:0): Locking max tag count at 64

After doing a hard reboot ext2 made me do a manual fsck, but it seems ok now. I was not able to produce this error in 2.5.1-pre8.

Thanks,
Paul Larson

#1 lore raw
Quoted 23 lines · Paul Larson

My hardware is a dual proc PII-300. I was running LTP runalltests.sh and it was on one of the growfiles tests when this problem occurred. The test hung, and I couldn't telnet into the machine or login to it, but I could switch between VC's. On the console, I had screenfulls of errors like this:

Incorrect number of segments after building list
counted 11, received 7
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 14, received 10
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 13, received 11
req nr_sec 584, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
(scsi0:A:5:0): Locking max tag count at 64

Quoted 2 lines

After doing a hard reboot ext2 made me do a manual fsck, but it seems ok now. I was not able to produce this error in 2.5.1-pre8.

Please don't tell me what hardware you have :-)

Signature · 1 line
Jens Axboe
#2 lore raw
In reply to Paul Larson
Quoted 24 lines · Jens Axboe
Quoted 23 lines · Paul Larson

My hardware is a dual proc PII-300. I was running LTP runalltests.sh and it was on one of the growfiles tests when this problem occurred. The test hung, and I couldn't telnet into the machine or login to it, but I could switch between VC's. On the console, I had screenfulls of errors like this:

Incorrect number of segments after building list
counted 11, received 7
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 14, received 10
req nr_sec 1024, cur_nr_sec 8
Incorrect number of segments after building list
counted 13, received 11
req nr_sec 584, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
Incorrect number of segments after building list
counted 2, received 1
req nr_sec 16, cur_nr_sec 8
(scsi0:A:5:0): Locking max tag count at 64

Quoted 4 lines
Quoted 2 lines

After doing a hard reboot ext2 made me do a manual fsck, but it seems ok now. I was not able to produce this error in 2.5.1-pre8.

Please don't tell me what hardware you have :-)

It seems to affect all SCSI drivers with CLUSTERING enabled. Don't worry about data consistency btw, the above is a warning only (the right segment count is used).

Signature · 1 line
Jens Axboe
#3 lore raw
Quoted 3 lines · Jens Axboe

It seems to affect all SCSI drivers with CLUSTERING enabled. Don't worry about data consistency btw, the above is a warning only (the right segment count is used).

So... this isn't a problem that my machine was locked up, I couldn't log in, or break out of the hung process, and it came back in an inconsistant state?

#4 lore raw
In reply to Paul Larson
Quoted 7 lines · Paul Larson
Quoted 3 lines · Jens Axboe

It seems to affect all SCSI drivers with CLUSTERING enabled. Don't worry about data consistency btw, the above is a warning only (the right segment count is used).

So... this isn't a problem that my machine was locked up, I couldn't log in, or break out of the hung process, and it came back in an

Of course it's a problem, it locked because of hitting the segment BUG in ll_rw_blk most likely.

Quoted 1 line

inconsistant state?

... which fsck fixed, I'm saying the condition in itself does not cause data corruption.

Signature · 1 line
Jens Axboe
#5 lore raw
In reply to Paul Larson
Quoted 8 lines · Paul Larson

My hardware is a dual proc PII-300. I was running LTP runalltests.sh and it was on one of the growfiles tests when this problem occurred. The test hung, and I couldn't telnet into the machine or login to it, but I could switch between VC's. On the console, I had screenfulls of errors like this:

Incorrect number of segments after building list
counted 11, received 7

Attached patch should fix it.

Signature · 1 line
Jens Axboe
#6 lore raw
Quoted 3 lines

In that case you perhaps should be defining DMA_CHUNK_SIZE in asm/dma.h :-)

Hmm I have it defined, just not in dma.h :) I'll fix it now and retest.

Anton

#7 lore raw

From: Anton Blanchard <[email protected]>
Date: Wed, 12 Dec 2001 09:17:47 +1100

Quoted 2 lines

In that case you perhaps should be defining DMA_CHUNK_SIZE in asm/dma.h :-)

Hmm I have it defined, just not in dma.h :) I'll fix it now and retest.

Oh nevermind then, the location really is almost arbitrary. As long as scsi_merge.c sees it.

Note this is one area Jens hasn't been able to test and I've been trying first to solidify my sparc64 setup without DMA_CHUNK_SIZE defined.

#8 lore raw
In reply to Anton Blanchard
Quoted 11 lines · David S. Miller

From: Jens Axboe <[email protected]>
Date: Wed, 12 Dec 2001 10:02:53 +0100

Dave nailed this bug, Anton you'll want to apply it before testing :-) It fixes a case of too much copy'n paste with back merges + DMA_CHUNK_SIZE enabled.

There still are problems even after this fix.

In fact the failures look identical to what I was seeing before, first dbench from single user is insta-crash.

DMA_CHUNK_SIZE only, or regardless?

Signature · 1 line
Jens Axboe
#9 lore raw

From: Jens Axboe <[email protected]>
Date: Wed, 12 Dec 2001 10:21:48 +0100

Quoted 4 lines · David S. Miller

There still are problems even after this fix.

In fact the failures look identical to what I was seeing before, first dbench from single user is insta-crash.

DMA_CHUNK_SIZE only, or regardless?

DMA_CHUNK_SIZE is the only thing causing failures for me now.

#10 lore raw
In reply to Paul Larson
Quoted 11 lines · Jens Axboe
Quoted 8 lines · Paul Larson

My hardware is a dual proc PII-300. I was running LTP runalltests.sh and it was on one of the growfiles tests when this problem occurred. The test hung, and I couldn't telnet into the machine or login to it, but I could switch between VC's. On the console, I had screenfulls of errors like this:

Incorrect number of segments after building list
counted 11, received 7

Attached patch should fix it.

Aghr, here it is. Linus, please apply to 2.5.1-pre9.

(and yes note how the differences between the stock and scsi merge functons are getting smaller -- in fact, we can complete merge the two now)

drivers/block/ll_rw_blk.c renamed from opt/kernel/linux-2.5.1-pre9/drivers/block/ll_rw_blk.c +12 -27
diff -ur -X exclude /opt/kernel/linux-2.5.1-pre9/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
@@ -358,6 +358,8 @@
 
 	if (!BIO_CONTIG(bio, nxt))
 		return 0;
+	if (bio->bi_size + nxt->bi_size > q->max_segment_size)
+		return 0;
 
 	/*
 	 * bio and nxt are contigous in memory, check if the queue allows
@@ -429,8 +431,10 @@
  * specific ones if so desired
  */
 static inline int ll_new_segment(request_queue_t *q, struct request *req,
-				 struct bio *bio, int nr_segs)
+				 struct bio *bio)
 {
+	int nr_segs = bio_hw_segments(q, bio);
+
 	if (req->nr_segments + nr_segs <= q->max_segments) {
 		req->nr_segments += nr_segs;
 		return 1;
@@ -443,41 +447,23 @@
 static int ll_back_merge_fn(request_queue_t *q, struct request *req, 
 			    struct bio *bio)
 {
-	int bio_segs;
-
 	if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) {
 		req->flags |= REQ_NOMERGE;
 		return 0;
 	}
 
-	bio_segs = bio_hw_segments(q, bio);
-	if (blk_contig_segment(q, req->biotail, bio))
-		bio_segs--;
-
-	if (!bio_segs)
-		return 1;
-
-	return ll_new_segment(q, req, bio, bio_segs);
+	return ll_new_segment(q, req, bio);
 }
 
 static int ll_front_merge_fn(request_queue_t *q, struct request *req, 
 			     struct bio *bio)
 {
-	int bio_segs;
-
 	if (req->nr_sectors + bio_sectors(bio) > q->max_sectors) {
 		req->flags |= REQ_NOMERGE;
 		return 0;
 	}
 
-	bio_segs = bio_hw_segments(q, bio);
-	if (blk_contig_segment(q, bio, req->bio))
-		bio_segs--;
-
-	if (!bio_segs)
-		return 1;
-
-	return ll_new_segment(q, req, bio, bio_segs);
+	return ll_new_segment(q, req, bio);
 }
 
 static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
@@ -1235,11 +1221,6 @@
 			break;
 		}
 
-		/*
-		 * this needs to be handled by q->make_request_fn, to just
-		 * setup a part of the bio in the request to enable easy
-		 * multiple passing
-		 */
 		BUG_ON(bio_sectors(bio) > q->max_sectors);
 
 		/*
@@ -1497,6 +1478,7 @@
 	while ((bio = req->bio)) {
 		nsect = bio_iovec(bio)->bv_len >> 9;
 
+		BIO_BUG_ON(bio_iovec(bio)->bv_len > bio->bi_size);
 
 		/*
 		 * not a complete bvec done
@@ -1515,11 +1497,12 @@
 		 * account transfer
 		 */
 		bio->bi_size -= bio_iovec(bio)->bv_len;
+		bio->bi_idx++;
 
 		nr_sectors -= nsect;
 		total_nsect += nsect;
 
-		if (++bio->bi_idx >= bio->bi_vcnt) {
+		if (!bio->bi_size) {
 			req->bio = bio->bi_next;
 
 			if (unlikely(bio_endio(bio, uptodate, total_nsect)))
@@ -1619,7 +1602,9 @@
 EXPORT_SYMBOL(blk_queue_max_segments);
 EXPORT_SYMBOL(blk_queue_max_segment_size);
 EXPORT_SYMBOL(blk_queue_hardsect_size);
+EXPORT_SYMBOL(blk_queue_segment_boundary);
 EXPORT_SYMBOL(blk_rq_map_sg);
 EXPORT_SYMBOL(blk_nohighio);
 EXPORT_SYMBOL(blk_dump_rq_flags);
 EXPORT_SYMBOL(submit_bio);
+EXPORT_SYMBOL(blk_contig_segment);
drivers/scsi/ide-scsi.c renamed from opt/kernel/linux-2.5.1-pre9/drivers/scsi/ide-scsi.c +4 -3
diff -ur -X exclude /opt/kernel/linux-2.5.1-pre9/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
@@ -261,7 +261,7 @@
 	ide_drive_t *drive = hwgroup->drive;
 	idescsi_scsi_t *scsi = drive->driver_data;
 	struct request *rq = hwgroup->rq;
-	idescsi_pc_t *pc = (idescsi_pc_t *) rq->buffer;
+	idescsi_pc_t *pc = (idescsi_pc_t *) rq->special;
 	int log = test_bit(IDESCSI_LOG_CMD, &scsi->log);
 	struct Scsi_Host *host;
 	u8 *scsi_buf;
@@ -464,7 +464,7 @@
 #endif /* IDESCSI_DEBUG_LOG */
 
 	if (rq->flags & REQ_SPECIAL) {
-		return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->buffer);
+		return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->special);
 	}
 	blk_dump_rq_flags(rq, "ide-scsi: unsup command");
 	idescsi_end_request (0,HWGROUP (drive));
@@ -662,6 +662,7 @@
 	if ((first_bh = bhp = bh = bio_alloc(GFP_ATOMIC, 1)) == NULL)
 		goto abort;
 	bio_init(bh);
+	bh->bi_vcnt = 1;
 	while (--count) {
 		if ((bh = bio_alloc(GFP_ATOMIC, 1)) == NULL)
 			goto abort;
@@ -802,7 +803,7 @@
 	}
 
 	ide_init_drive_cmd (rq);
-	rq->buffer = (char *) pc;
+	rq->special = (char *) pc;
 	rq->bio = idescsi_dma_bio (drive, pc);
 	rq->flags = REQ_SPECIAL;
 	spin_unlock(&cmd->host->host_lock);
drivers/scsi/scsi_merge.c renamed from opt/kernel/linux-2.5.1-pre9/drivers/scsi/scsi_merge.c +23 -70

174 lines not on this page · raw message

fs/bio.c renamed from opt/kernel/linux-2.5.1-pre9/fs/bio.c +6 -43

83 lines not on this page · raw message

fs/partitions/acorn.c renamed from opt/kernel/linux-2.5.1-pre9/fs/partitions/acorn.c +3 -3
diff -ur -X exclude /opt/kernel/linux-2.5.1-pre9/fs/partitions/acorn.c linux/fs/partitions/acorn.c
@@ -162,12 +162,12 @@
 		struct adfs_discrecord *dr;
 		unsigned int nr_sects;
 
-		if (!(minor & mask))
-			break;
-
 		data = read_dev_sector(bdev, start_blk * 2 + 6, &sect);
 		if (!data)
 			return -1;
+
+		if (!(minor & mask))
+			break;
 
 		dr = adfs_partition(hd, name, data, first_sector, minor++);
 		if (!dr)
fs/partitions/check.h renamed from opt/kernel/linux-2.5.1-pre9/fs/partitions/check.h +2 -0
diff -ur -X exclude /opt/kernel/linux-2.5.1-pre9/fs/partitions/check.h linux/fs/partitions/check.h
@@ -1,3 +1,5 @@
+#include <linux/pagemap.h>
+
 /*
  * add_gd_partition adds a partitions details to the devices partition
  * description.
include/linux/bio.h renamed from opt/kernel/linux-2.5.1-pre9/include/linux/bio.h +3 -1
diff -ur -X exclude /opt/kernel/linux-2.5.1-pre9/include/linux/bio.h linux/include/linux/bio.h
@@ -28,6 +28,8 @@
 #define BIO_BUG_ON
 #endif
 
+#define BIO_MAX_SECTORS	128
+
 /*
  * was unsigned short, but we might as well be ready for > 64kB I/O pages
  */
@@ -60,7 +62,7 @@
 	unsigned short		bi_vcnt;	/* how many bio_vec's */
 	unsigned short		bi_idx;		/* current index into bvl_vec */
 	unsigned short		bi_hw_seg;	/* actual mapped segments */
-	unsigned int		bi_size;	/* total size in bytes */
+	unsigned int		bi_size;	/* residual I/O count */
 	unsigned int		bi_max;		/* max bvl_vecs we can hold,
 						   used as index into pool */
 
Signature · 1 line
Jens Axboe
#11 lore raw
In reply to Paul Larson

Hi Jens,

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Incorrect number of segments after building list
counted 11, received 7

Attached patch should fix it.

I just booted 2.5.1-pre10 on ppc64 and still get the errors:

Incorrect number of segments after building list
counted 3, received 2
req nr_sec 24, cur_nr_sec 8

This seems to be happening because we now allow sg merging through the BIOVEC_MERGEABLE macro. On ppc64 (and sparc64) we can coalesce two sg entries if the first one ends on a page boundary and the next one starts on a page boundary because we have an IO MMU. (I know that you know this, Im just explaining it for those who dont :)

Should we just remove the warning now?

Anton

#12 lore raw

From: Anton Blanchard <[email protected]>
Date: Wed, 12 Dec 2001 08:28:02 +1100

This seems to be happening because we now allow sg merging through the BIOVEC_MERGEABLE macro. On ppc64 (and sparc64) we can coalesce two sg entries if the first one ends on a page boundary and the next one starts on a page boundary because we have an IO MMU. (I know that you know this, Im just explaining it for those who dont :)

In that case you perhaps should be defining DMA_CHUNK_SIZE in asm/dma.h :-)

#13 lore raw
In reply to Anton Blanchard
Quoted 6 lines · David S. Miller

From: Anton Blanchard <[email protected]>
Date: Wed, 12 Dec 2001 09:17:47 +1100

Quoted 2 lines

In that case you perhaps should be defining DMA_CHUNK_SIZE in asm/dma.h :-)

Quoted 8 lines

Hmm I have it defined, just not in dma.h :) I'll fix it now and retest.

Oh nevermind then, the location really is almost arbitrary. As long as scsi_merge.c sees it.

Note this is one area Jens hasn't been able to test and I've been trying first to solidify my sparc64 setup without DMA_CHUNK_SIZE defined.

Dave nailed this bug, Anton you'll want to apply it before testing :-) It fixes a case of too much copy'n paste with back merges + DMA_CHUNK_SIZE enabled.

Signature · 1 line
Jens Axboe
scsi/scsi_merge.c renamed from opt/kernel/linux-2.5.1-pre10/drivers/scsi/scsi_merge.c +1 -1
@@ -307,7 +307,7 @@
 	}
 
 #ifdef DMA_CHUNK_SIZE
-	if (MERGEABLE_BUFFERS(bio, req->bio))
+	if (MERGEABLE_BUFFERS(req->biotail, bio))
 		return scsi_new_mergeable(q, req, bio);
 #endif
 
#14 lore raw

From: Jens Axboe <[email protected]>
Date: Wed, 12 Dec 2001 10:02:53 +0100

Dave nailed this bug, Anton you'll want to apply it before testing :-) It fixes a case of too much copy'n paste with back merges + DMA_CHUNK_SIZE enabled.

There still are problems even after this fix.

In fact the failures look identical to what I was seeing before, first dbench from single user is insta-crash.

#15 lore raw
In reply to Jens Axboe
Quoted 6 lines · David S. Miller

From: Jens Axboe <[email protected]>
Date: Wed, 12 Dec 2001 10:21:48 +0100

Quoted 2 lines · David S. Miller

There still are problems even after this fix.

Quoted 7 lines
Quoted 2 lines

In fact the failures look identical to what I was seeing before, first dbench from single user is insta-crash.

DMA_CHUNK_SIZE only, or regardless?

DMA_CHUNK_SIZE is the only thing causing failures for me now.

Alright, that's a least good news to some extent :-)

Signature · 1 line
Jens Axboe