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

Ingo Molnar
2007-10-18T10:56:07Z

* Jeff Garzik <jeff@garzik.org> wrote:

> >Tomo and I agreed to kill sg_last() a few days ago anyways, so this
> >is perfectly fine with me.
>
> Yep, the [attached] patch that kills ata_sg_is_last() is working here
> on both machines that were previously croaking.
>
> It would be nice to get pdc_adma, sata_sil24 and ipr it-works test
> done, but IMO the patch is pretty straightforward and should be OK.

just a quick question: i have Jens's workarounds applied right now (see
patch below). Am i now crash/corruption-safe, or do i need your patch
too? And once your patch [and the other sg_*() patches] are upstream i
dont need the workaround anymore, correct?

Ingo

---
block/ll_rw_blk.c | 2 +-
drivers/ata/libata-core.c | 2 +-
drivers/scsi/scsi_lib.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

Index: linux/block/ll_rw_blk.c
===================================================================
--- linux.orig/block/ll_rw_blk.c
+++ linux/block/ll_rw_blk.c
@@ -631,7 +631,7 @@ void blk_queue_max_phys_segments(struct
printk("%s: set to minimum %d\n", __FUNCTION__, max_segments);
}

- q->max_phys_segments = max_segments;
+ q->max_phys_segments = max_segments - 1;
}

EXPORT_SYMBOL(blk_queue_max_phys_segments);
Index: linux/drivers/ata/libata-core.c
===================================================================
--- linux.orig/drivers/ata/libata-core.c
+++ linux/drivers/ata/libata-core.c
@@ -4664,7 +4664,7 @@ static int ata_sg_setup(struct ata_queue
{
struct ata_port *ap = qc->ap;
struct scatterlist *sg = qc->__sg;
- struct scatterlist *lsg = sg_last(qc->__sg, qc->n_elem);
+ struct scatterlist *lsg = &qc->__sg[qc->n_elem - 1];
int n_elem, pre_n_elem, dir, trim_sg = 0;

VPRINTK("ENTER, ata%u\n", ap->print_id);
Index: linux/drivers/scsi/scsi_lib.c
===================================================================
--- linux.orig/drivers/scsi/scsi_lib.c
+++ linux/drivers/scsi/scsi_lib.c
@@ -39,7 +39,7 @@
* (unless chaining is used). Should ideally fit inside a single page, to
* avoid a higher order allocation.
*/
-#define SCSI_MAX_SG_SEGMENTS 128
+#define SCSI_MAX_SG_SEGMENTS 129

struct scsi_host_sg_pool {
size_t size;