public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements
@ 2012-03-22 18:08 Stephen M. Cameron
  2012-03-22 18:08 ` [PATCH 2/2] cciss: Initialize scsi host max_sectors for tape drive support Stephen M. Cameron
  2012-03-22 20:33 ` [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Stephen M. Cameron @ 2012-03-22 18:08 UTC (permalink / raw)
  To: axboe; +Cc: stephenmcameron, akpm, mikem, linux-kernel, thenzl

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

The total number of scatter gather elements in the CISS command
used by the scsi tape code was being cast to a u8, which can hold
at most 255 scatter gather elements.  It should have been cast to
a u16.  Without this patch the command gets rejected by the controller
since the total scatter gather count did not add up to the right
value resulting in an i/o error.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@vger.kernel.org
---
 drivers/block/cciss_scsi.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index e820b68..1162f7b 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1410,7 +1410,7 @@ static void cciss_scatter_gather(ctlr_info_t *h, CommandList_struct *c,
 	/* track how many SG entries we are using */
 	if (request_nsgs > h->maxSG)
 		h->maxSG = request_nsgs;
-	c->Header.SGTotal = (__u8) request_nsgs + chained;
+	c->Header.SGTotal = (u16) request_nsgs + chained;
 	if (request_nsgs > h->max_cmd_sgentries)
 		c->Header.SGList = h->max_cmd_sgentries;
 	else


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] cciss: Initialize scsi host max_sectors for tape drive support
  2012-03-22 18:08 [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Stephen M. Cameron
@ 2012-03-22 18:08 ` Stephen M. Cameron
  2012-03-22 20:33 ` [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen M. Cameron @ 2012-03-22 18:08 UTC (permalink / raw)
  To: axboe; +Cc: stephenmcameron, akpm, mikem, linux-kernel, thenzl

From: Stephen M. Cameron <scameron@beardog.cce.hp.com>

The default is too small (1024 blocks), use h->cciss_max_sectors (8192 blocks)
Without this change, if you try to set the block size of a tape drive above
512*1024, via "mt -f /dev/st0 setblk nnn" where nnn is greater than 524288,
it won't work right.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@vger.kernel.org
---
 drivers/block/cciss_scsi.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 1162f7b..acda773 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -866,6 +866,7 @@ cciss_scsi_detect(ctlr_info_t *h)
 	sh->can_queue = cciss_tape_cmds;
 	sh->sg_tablesize = h->maxsgentries;
 	sh->max_cmd_len = MAX_COMMAND_SIZE;
+	sh->max_sectors = h->cciss_max_sectors;
 
 	((struct cciss_scsi_adapter_data_t *) 
 		h->scsi_ctlr)->scsi_host = sh;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements
  2012-03-22 18:08 [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Stephen M. Cameron
  2012-03-22 18:08 ` [PATCH 2/2] cciss: Initialize scsi host max_sectors for tape drive support Stephen M. Cameron
@ 2012-03-22 20:33 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2012-03-22 20:33 UTC (permalink / raw)
  To: Stephen M. Cameron; +Cc: stephenmcameron, akpm, mikem, linux-kernel, thenzl

On 2012-03-22 19:08, Stephen M. Cameron wrote:
> From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
> 
> The total number of scatter gather elements in the CISS command
> used by the scsi tape code was being cast to a u8, which can hold
> at most 255 scatter gather elements.  It should have been cast to
> a u16.  Without this patch the command gets rejected by the controller
> since the total scatter gather count did not add up to the right
> value resulting in an i/o error.

Thanks Stephen, applied both patches.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-22 20:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 18:08 [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Stephen M. Cameron
2012-03-22 18:08 ` [PATCH 2/2] cciss: Initialize scsi host max_sectors for tape drive support Stephen M. Cameron
2012-03-22 20:33 ` [PATCH 1/2] cciss: Fix scsi tape io with more than 255 scatter gather elements Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox