All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pete Wyckoff <pw-pxmRpbKlMIQ@public.gmane.org>
To: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
Cc: Mike Christie <michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org>,
	linux-scsi <linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Benny Halevy <bhalevy-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>,
	Daniel.E.Messinger-ShLqkCeKS0lBDgjK7y7TUQ@public.gmane.org
Subject: Re: [PATCH 2/3] iscsi: bidi support - libiscsi
Date: Mon, 11 Feb 2008 10:43:09 -0500	[thread overview]
Message-ID: <20080211154309.GA27183@osc.edu> (raw)
In-Reply-To: <47A22FC4.2020804-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>


bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org wrote on Thu, 31 Jan 2008 22:29 +0200:
>   iscsi bidi support at the generic libiscsi level
>   - prepare the additional bidi_read rlength header.
>   - access the right scsi_in() and/or scsi_out() side of things.
>     also for resid.
>   - Handle BIDI underflow overflow from target
> 
> Signed-off-by: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>

I see you do this a bit differently than in your previous patch set.
In particular, the residual handling in libiscsi.c.  (I'm editing in
a bit more context to the patch below.)

> +	if (scsi_bidi_cmnd(sc) &&
> +		(rhdr->flags & (ISCSI_FLAG_CMD_BIDI_UNDERFLOW |
> +					ISCSI_FLAG_CMD_BIDI_OVERFLOW))) {
> +		int res_count = be32_to_cpu(rhdr->bi_residual_count);
> +
> +		if (res_count > 0 &&
> +			(rhdr->flags & ISCSI_FLAG_CMD_BIDI_OVERFLOW ||
> +			res_count <= scsi_in(sc)->length))
> +			scsi_in(sc)->resid = res_count;
> +		else
> +			sc->result =
> +				(DID_BAD_TARGET << 16) | rhdr->cmd_status;
> +	}
> +
>  	if (rhdr->flags & (ISCSI_FLAG_CMD_UNDERFLOW |
>  	                   ISCSI_FLAG_CMD_OVERFLOW)) {
>  		int res_count = be32_to_cpu(rhdr->residual_count);
>
>  		if (res_count > 0 &&
>  		    (rhdr->flags & ISCSI_FLAG_CMD_OVERFLOW ||
>  		     res_count <= scsi_bufflen(sc)))
> +			/* write side for bidi or uni-io set_resid */
>  			scsi_set_resid(sc, res_count);
>  		else
>  			sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;
>       } else if (rhdr->flags & (ISCSI_FLAG_CMD_BIDI_UNDERFLOW |
>                                 ISCSI_FLAG_CMD_BIDI_OVERFLOW))
>               sc->result = (DID_BAD_TARGET << 16) | rhdr->cmd_status;

I haven't tested this, but, consider a bidi command that results in
an overflow on the read part, and no overflow on the write part.
E.g., the user supplied a data-in buffer that wasn't big enough to
hold the returned data from the target, but the data-out buffer was
just right.

Then this code will set scsi_in(sc)->resid properly, informing the
caller that there were extra bytes that were not transferred.  But
the "else" clause at the bottom will also set sc->result to be bad.
I don't think we want this.

Your earlier patch got rid of the second bidi_overflow handler and
just did all the logic for both bidi and non-bidi cases in a single
if clause.  Seemed better.

		-- Pete

  parent reply	other threads:[~2008-02-11 15:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-31 18:08 [PATCH 0/3] iscsi bidi & varlen support Boaz Harrosh
2008-01-31 20:25 ` [PATCH 1/3] iscsi: extended cdb support Boaz Harrosh
2008-01-31 20:29 ` [PATCH 2/3] iscsi: bidi support - libiscsi Boaz Harrosh
     [not found]   ` <47A22FC4.2020804-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2008-02-11 15:43     ` Pete Wyckoff [this message]
2008-02-11 16:05       ` Boaz Harrosh
     [not found]         ` <47B0724C.2060108-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2008-02-11 16:24           ` Pete Wyckoff
2008-01-31 20:31 ` [PATCH 3/3] iscsi: bidi support - iscsi_tcp Boaz Harrosh
2008-02-12 20:12 ` [PATCH 0/3] iscsi bidi & varlen support Pete Wyckoff
2008-02-12 20:17   ` Pete Wyckoff
2008-02-18 15:39     ` Boaz Harrosh
2008-02-18 16:03       ` Pete Wyckoff
2008-02-18 15:08 ` [PATCH 0/3 ver2] " Boaz Harrosh
2008-02-18 15:16   ` [PATCH 1/3 ver2] iscsi: extended cdb support Boaz Harrosh
2008-02-18 15:22   ` [PATCH 2/3 ver2] iscsi: bidi support - libiscsi Boaz Harrosh
2008-02-18 15:27   ` [PATCH 3/3 ver2] iscsi: bidi support - iscsi_tcp Boaz Harrosh
2008-02-18 17:22   ` [PATCH 0/3 ver2] iscsi bidi & varlen support James Bottomley
2008-02-18 17:33     ` Boaz Harrosh
  -- strict thread matches above, loose matches on Subject: below --
2008-04-18 15:11 iscsi update for 2.6.26 michaelc
2008-04-18 15:11 ` [PATCH 1/3] iscsi: extended cdb support michaelc
2008-04-18 15:11   ` [PATCH 2/3] iscsi: bidi support - libiscsi michaelc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080211154309.GA27183@osc.edu \
    --to=pw-pxmrpbklmiq@public.gmane.org \
    --cc=Daniel.E.Messinger-ShLqkCeKS0lBDgjK7y7TUQ@public.gmane.org \
    --cc=bhalevy-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org \
    --cc=bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=michaelc-hcNo3dDEHLuVc3sceRu5cw@public.gmane.org \
    --cc=open-iscsi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.