* [PATCH] Initialise scatter/gather list in sg driver
@ 2007-10-25 19:29 Anton Blanchard
0 siblings, 0 replies; 3+ messages in thread
From: Anton Blanchard @ 2007-10-25 19:29 UTC (permalink / raw)
To: jens.axboe; +Cc: linux-kernel
After turning on DEBUG_SG I hit a fail:
kernel BUG at include/linux/scatterlist.h:50!
ata_qc_issue
ata_scsi_translate
ipr_queuecommand
scsi_dispatch_cmd
scsi_request_fn
elv_insert
blk_execute_rq_nowait
blk_execute_rq
sg_io
scsi_cmd_ioctl
cdrom_ioctl
sr_block_ioctl
blkdev_driver_ioctl
blkdev_ioctl
block_ioctl
do_ioctl
vfs_ioctl
sys_ioctl
sg_ioctl_trans
It looks like ata_sg_setup is working on an uninitialised sg table. Call
sg_init_table to initialise it before use.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
Jens this is against your sg branch. This fixes the fail but Id
appreciate a confirmation that it's the right fix :)
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b5f7c59..4de41bb 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4689,6 +4689,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
* data in this function or read data in ata_sg_clean.
*/
offset = lsg->offset + lsg->length - qc->pad_len;
+ sg_init_table(psg, 1);
sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
qc->pad_len, offset_in_page(offset));
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] Initialise scatter/gather list in sg driver
@ 2007-10-25 19:35 Anton Blanchard
2007-10-26 11:59 ` Jens Axboe
0 siblings, 1 reply; 3+ messages in thread
From: Anton Blanchard @ 2007-10-25 19:35 UTC (permalink / raw)
To: jens.axboe; +Cc: linux-kernel
After turning on DEBUG_SG I hit a fail:
kernel BUG at include/linux/scatterlist.h:50!
sg_build_indirect
sg_build_reserve
sg_open
chrdev_open
__dentry_open
do_filp_open
do_sys_open
We should initialise the sg list when we allocate it in sg_build_sgat.
Signed-off-by: Anton Blanchard <anton@samba.org>
---
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b5fa4f0..f1871ea 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
schp->buffer = kzalloc(sg_bufflen, gfp_flags);
if (!schp->buffer)
return -ENOMEM;
+ sg_init_table(schp->buffer, tablesize);
schp->sglist_len = sg_bufflen;
return tablesize; /* number of scat_gath elements allocated */
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Initialise scatter/gather list in sg driver
2007-10-25 19:35 [PATCH] Initialise scatter/gather list in sg driver Anton Blanchard
@ 2007-10-26 11:59 ` Jens Axboe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2007-10-26 11:59 UTC (permalink / raw)
To: Anton Blanchard; +Cc: linux-kernel
On Thu, Oct 25 2007, Anton Blanchard wrote:
>
> After turning on DEBUG_SG I hit a fail:
>
> kernel BUG at include/linux/scatterlist.h:50!
>
> sg_build_indirect
> sg_build_reserve
> sg_open
> chrdev_open
> __dentry_open
> do_filp_open
> do_sys_open
>
> We should initialise the sg list when we allocate it in sg_build_sgat.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
>
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index b5fa4f0..f1871ea 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
> schp->buffer = kzalloc(sg_bufflen, gfp_flags);
> if (!schp->buffer)
> return -ENOMEM;
> + sg_init_table(schp->buffer, tablesize);
> schp->sglist_len = sg_bufflen;
> return tablesize; /* number of scat_gath elements allocated */
> }
Thanks, applied!
--
Jens Axboe
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-10-26 12:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-25 19:35 [PATCH] Initialise scatter/gather list in sg driver Anton Blanchard
2007-10-26 11:59 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2007-10-25 19:29 Anton Blanchard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox