Re: [bug] ata subsystem related crash with latest -git

Mark Lord
2007-10-18T14:00:09Z

Jens Axboe wrote:
> On Thu, Oct 18 2007, Mark Lord wrote:
>> Jens Axboe wrote:
>>> On Thu, Oct 18 2007, Mark Lord wrote:
>>>> Jens Axboe wrote:
>>>>> On Thu, Oct 18 2007, Jeff Garzik wrote:
>>>>>> Mark Lord wrote:
>>>>>>> Okay, mine is dying with EIP at blk_rq_map_sg+0xcb/0x160.
>>>>>>> Screen photo is at http://rtr.ca/recent/2.6.23-git12-crash.jpg,
>>>>>>> but the top was cut off (isn't there a new config option or patch
>>>>>>> to do double-columns or scrollback or something ???.
>>>>>> Is this a sata_mv box? If so, could you try this patch?
>>>>> If anything, that shrinks the size of the resulting request. Did this
>>>>> patch make any difference to you?
>>>> Not a sata_mv box, so no point here.
>>> Can you try the big patch I just posted?
>> I'll hunt for it and try it, but your earlier little patch already works
>> fine.

I found the latest rev, and it failed to apply cleanly on -git12 or -git13
due to scsi_lib.c. After fixing that portion (replacement chunk below),
I'm now running with -git12, with the sg list debug option enabled (no messages).

Looks okay so far

--- a/drivers/scsi/scsi_lib.c 2007-10-18 09:35:28.000000000 -0400
+++ b/drivers/scsi/scsi_lib.c 2007-10-18 09:46:47.000000000 -0400
@@ -295,7 +295,7 @@
int i, err, nr_vecs = 0;

for_each_sg(sgl, sg, nsegs, i) {
- page = sg->page;
+ page = sg_page(sg);
off = sg->offset;
len = sg->length;
data_len += len;
@@ -764,6 +764,8 @@
if (unlikely(!sgl))
goto enomem;

+ sg_init_table(sgl, sgp->size);
+
/*
* first loop through, set initial index and return value
*/
@@ -779,6 +781,13 @@
sg_chain(prev, SCSI_MAX_SG_SEGMENTS, sgl);

/*
+ * if we have nothing left, mark the last segment as
+ * end-of-list
+ */
+ if (!left)
+ sg_mark_end(sgl, this);
+
+ /*
* don't allow subsequent mempool allocs to sleep, it would
* violate the mempool principle.
*/
@@ -2351,7 +2360,7 @@
*offset = *offset - len_complete + sg->offset;

/* Assumption: contiguous pages can be accessed as "page + i" */
- page = nth_page(sg->page, (*offset >> PAGE_SHIFT));
+ page = nth_page(sg_page(sg), (*offset >> PAGE_SHIFT));
*offset &= ~PAGE_MASK;

/* Bytes in this sg-entry from *offset to the end of the page */