Apologies for the attachment.. Outlook just does its own thing no matter what I want. Basically same patch as before, but replaced Illegal with Invalid. Cheers Mark $ git diff diff --git a/usr/bs_sg.c b/usr/bs_sg.c index 69cce9b..a1be14b 100644 --- a/usr/bs_sg.c +++ b/usr/bs_sg.c @@ -247,6 +247,7 @@ static void bs_sg_cmd_complete(int fd, int events, void *dat struct sg_io_hdr io_hdr; struct scsi_cmd *cmd; int err; + unsigned resid; memset(&io_hdr, 0, sizeof(io_hdr)); io_hdr.interface_id = 'S'; @@ -261,9 +262,15 @@ static void bs_sg_cmd_complete(int fd, int events, void *da scsi_set_out_resid(cmd, io_hdr.resid); scsi_set_in_resid(cmd, io_hdr.resid); } else { + /* NO SENSE | ILI (Invalid Length Indicator) set */ + if (io_hdr.sbp[2] == 0x20) + resid = io_hdr.dxfer_len - io_hdr.resid; + else + resid = 0; + cmd->sense_len = io_hdr.sb_len_wr; - scsi_set_out_resid_by_actual(cmd, 0); - scsi_set_in_resid_by_actual(cmd, 0); + scsi_set_out_resid_by_actual(cmd, resid); + scsi_set_in_resid_by_actual(cmd, resid); } cmd->scsi_cmd_done(cmd, io_hdr.status); -----Original Message----- From: Mark Harvey [mailto:markh794@xxxxxxxxx] Sent: Saturday, April 09, 2011 5:50 AM To: stgt@xxxxxxxxxxxxxxx Cc: Mark Harvey Subject: [PATCH] Handle ILI bit via sg backing store From f5bb9b9e7fb635693435de3b23b528f669493731 Mon Sep 17 00:00:00 2001 From: Mark Harvey<markh794@xxxxxxxxx> Date: Sat, 9 Apr 2011 05:46:29 +1000 Subject: Handle Illegal Length Indicator in sg backing store If ILI sense bit set, return available data. Signed-off-by: Mark Harvey<markh794@xxxxxxxxx> --- usr/bs_sg.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/usr/bs_sg.c b/usr/bs_sg.c index 69cce9b..6455210 100644 --- a/usr/bs_sg.c +++ b/usr/bs_sg.c @@ -247,6 +247,7 @@ static void bs_sg_cmd_complete(int fd, int events, void *data) struct sg_io_hdr io_hdr; struct scsi_cmd *cmd; int err; + unsigned resid; memset(&io_hdr, 0, sizeof(io_hdr)); io_hdr.interface_id = 'S'; @@ -261,9 +262,14 @@ static void bs_sg_cmd_complete(int fd, int events, void *data) scsi_set_out_resid(cmd, io_hdr.resid); scsi_set_in_resid(cmd, io_hdr.resid); } else { + if (io_hdr.sbp[2] == 0x20) /* Illegal Length Indicator set */ + resid = io_hdr.dxfer_len - io_hdr.resid; + else + resid = 0; + cmd->sense_len = io_hdr.sb_len_wr; - scsi_set_out_resid_by_actual(cmd, 0); - scsi_set_in_resid_by_actual(cmd, 0); + scsi_set_out_resid_by_actual(cmd, resid); + scsi_set_in_resid_by_actual(cmd, resid); } cmd->scsi_cmd_done(cmd, io_hdr.status); -- 1.7.0.4
Attachment:
0001-Handle-ILI-sense-bit-via-sg-backing-store.patch
Description: 0001-Handle-ILI-sense-bit-via-sg-backing-store.patch