linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Pete Wyckoff <pw@osc.edu>
Cc: Mike Christie <michaelc@cs.wisc.edu>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	open-iscsi@googlegroups.com, Benny Halevy <bhalevy@panasas.com>,
	Daniel.E.Messinger@seagate.com
Subject: Re: [PATCH 2/3] iscsi: bidi support - libiscsi
Date: Mon, 11 Feb 2008 18:05:32 +0200	[thread overview]
Message-ID: <47B0724C.2060108@panasas.com> (raw)
In-Reply-To: <20080211154309.GA27183@osc.edu>

On Mon, Feb 11 2008 at 17:43 +0200, Pete Wyckoff <pw@osc.edu> wrote:
> bharrosh@panasas.com 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@panasas.com>
> 
> 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
You are most probably right I will investigate what happened. It looks
like I went back to some old version right? or a merge fallout
Thanks for reviewing.

Please also test latest head-of-line code if possible + iscsi patches
+ last varlen I sent.

Is there any new patches I need for 2.6.24 or head-of-line for my 
osd-dev tree?

Boaz

  reply	other threads:[~2008-02-11 16:10 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
2008-02-11 16:05       ` Boaz Harrosh [this message]
     [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=47B0724C.2060108@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Daniel.E.Messinger@seagate.com \
    --cc=bhalevy@panasas.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=open-iscsi@googlegroups.com \
    --cc=pw@osc.edu \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).