cciss: Fix scsi tape io with more than 255 scatter gather elements
PATCH 1/2 cciss: Fix scsi tape io with more than 255 scatter gather elements
From: Stephen M. Cameron <[email protected]>
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.
--- drivers/block/cciss_scsi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/block/cciss_scsi.c +1 -1
@@ -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
PATCH 2/2 cciss: Initialize scsi host max_sectors for tape drive support
From: Stephen M. Cameron <[email protected]>
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.
--- drivers/block/cciss_scsi.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/block/cciss_scsi.c +1 -0
@@ -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;
Jens Axboe
maintainerQuoted 8 lines · Stephen M. Cameron
From: Stephen M. Cameron <[email protected]>
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.
Signature · 1 line
Jens Axboe