On Tue, 20 Sep 2005, Kai Makisara wrote: ... > If I try 5121 kB, write fails as is expected but not completely nicely. > Here are some test printks: > > scsi_req_map_sg: q->back_merge failed, i=10 > st 1:0:5:0: extraneous data discarded. > st 1:0:5:0: COMMAND FAILED (87 0 1). > sym: cmd: 0x0a 0x00 0x50 0x04 0x00 0x00 > st: cmd=0x0a result=0x70000 resid=0 sense[0]=0x00 sense[2]=0x00 > > scsi_req_map_sg fails as it should but still a bogus SCSI command is sent. > I think the reason for this is simple but I don't want to delay the good > news by trying to debug this. > The reason was simple: scsi_req_map_sg did not set err when q->back_merge failed. The patch at the end fixes the problem (I am not sure what would be the correct error code). -- Kai --- linux-2.6.14-rc1-blk3/drivers/scsi/scsi_lib.c.old 2005-09-22 22:57:53.000000000 +0300 +++ linux-2.6.14-rc1-blk3/drivers/scsi/scsi_lib.c 2005-09-22 22:58:14.000000000 +0300 @@ -360,6 +360,7 @@ blk_rq_bio_prep(q, rq, bio); else if (!q->back_merge_fn(q, rq, bio)) { bio_endio(bio, bio->bi_size, 0); + err = -ENOMEM; goto free_bios; } else { rq->biotail->bi_next = bio; - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html