[stgt] [PATCH] Handle ILI bit via sg backing store

FUJITA Tomonori fujita.tomonori at lab.ntt.co.jp
Thu Apr 14 10:54:36 CEST 2011


Sorry for the delay,

On Fri, 8 Apr 2011 21:43:12 -0700
Mark Harvey <mark_harvey at symantec.com> wrote:

> 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.

Should be 'incorrect length indicator'?


> 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);

This should be

scsi_set_in_resid_by_actual(cmd, io_hdr.resid);
scsi_set_in_resid_by_actual(cmd, io_hdr.resid);

?

I thought that sg sets a proper resid value to io_hdr.resid. No?
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list