public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Seokmann Ju <seokmann.ju@qlogic.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	jens.axboe@oracle.com, James.Smart@Emulex.Com,
	James.Bottomley@hansenpartnership.com,
	linux-scsi@vger.kernel.org, andrew.vasquez@qlogic.com,
	michaelc@cs.wisc.edu, robert.w.love@intel.com
Subject: Re: [PATCH 1/2] scsi_transport_fc: FC pass through support via bsg interface - revised
Date: Tue, 28 Oct 2008 16:55:34 +0200	[thread overview]
Message-ID: <490727E6.6010503@panasas.com> (raw)
In-Reply-To: <490723E8.9050801@panasas.com>

Boaz Harrosh wrote:
> Seokmann Ju wrote:
>> On Oct 28, 2008, at 12:57 AM, Boaz Harrosh wrote:
>>
>>> Seokmann Ju wrote:
>>>> On Oct 27, 2008, at 1:20 AM, Boaz Harrosh wrote:
>>>>
>>>>> FUJITA Tomonori wrote:
>>>>>> On Sun, 26 Oct 2008 11:38:04 +0200
>>>>>> Boaz Harrosh <bharrosh@panasas.com> wrote:
>>>>>>
>>>>>>> FUJITA Tomonori wrote:
>>>>>>>> CC'ed Jens,
>>>>>>> I think that all block-queue consumers should call one of
>>>>>>> blk_end_request(),
>>>>>> This is kinda what I suggested in the previous mail but as I wrote,
>>>>>> some of them don't now.
>>>>>>
>>>>> I think they should, specially if they're going to use the timer.
>>>>> The way I see it they must. It's kind of a block layer API thing.
>>>>> Someone calls blk_execute_xx then eventually someone needs to call
>>>>> blk_end_request. You could call it from bsg but only temporary until
>>>>> all are fixed. (because you will need an ugly check to see if  
>>>>> request
>>>>> was not already ended)
>>>> I made following changes but, it seems not helpful for the issue.
>>>> It, eventually, got failed to call blk_delete_timer() as ~/block/blk-
>>>> core.c:__end_that_request_first() returns non-zero.
>>>> Inside of the __end_that_reqeust_first(), it detected 'nbytes' is
>>>> bigger than 'nr_bytes' in case of bidi (where req->next_rq is not  
>>>> NULL).
>>>> I'm not sure whether we need to have chains of function calls
>>>> initiated by the blk_end_request() or blk_end_bidi_request().
>>>> Would it create any problems if we directly call  
>>>> 'blk_delete_timer()'?
>>>>
>>> Dear Seokmann. You miss understud me. What I'm saying is that you must
>>> call blk_end_bidi_request at the FC end, just after you have finished
>>> to consume the request, and before you return it upstream. it can be
>>> some thing like:
>>>
>>> +	blk_end_bidi_request(rq, 0, blk_rq_bytes(rq),
>>> +	                     rq->next_rq ?  blk_rq_bytes(rq->next_rq) : 0);
>>>
>>> In this case __end_that_reqeust_first should never return non-zero.
>> Hello Boaz,
>> Thank you for the clarification.
>> I made the changes accordingly and tested it, but the problem is still
>> there - same result of getting non-zero returns from
>> __end_that_request_first().
>> I guess that, either, I still get confused about the location or, there
>> is something else going on...
>>
>> Sorry, I don't have public git-web.
>> Here is snaptshot of the FC transport layer changes.
>> The fc_service_done() is the callback that the FC transport layer
>> provides. And that is the callback called by LLD before returning.
>>
>> Please let me know for any comments.
>>
>> Thank you,
>> Seokmann
> 
> if the attached file is the code you tested then it is wrong look here:
> 
>> +
>> +	if (service->srv_reply.residual) {
>> +		service->req->data_len = 0;
>> +		service->req->next_rq->data_len = service->srv_reply.residual;
>> +	} else {
>> +		service->req->data_len = 0;
>> +		service->req->next_rq->data_len = 0;
>> +	}
>> +
> 
> Move above to after the blk_end_bidi_request call
> 
>> +	blk_end_bidi_request(service->req, 0, blk_rq_bytes(service->req),
>> +	    service->req->next_rq ? blk_rq_bytes(service->req->next_rq) : 0);
> 
> You must call blk_end_bidi_request before you change service->req->data_len
> to hold the residual (or 0). Otherwise you damage the request.
> 
>> +	service->req->end_io(service->req, 0);

Hmm, on re inspection req->end_io(...) called here has the same problem.
Are you sure it's needed?

>> +	kfree(service->payload_dma);
>> +	kfree(service->response_dma);
>> +	kfree(service);
> 
> With bsg the request is held by one more reference count in bsg, but in
> general after the call to blk_end_bidi_request one/both request(s) may
> die. In that case you need a code like:
> 
> 	unsigned int dlen = blk_rq_bytes(req);
> 	unsigned int next_dlen = req->next_rq ? blk_rq_bytes(req->next_rq) : 0;
> 
> 	req->data_len = resid;
> 	if (req->next_rq)
> 		req->next_rq->data_len = bidi_resid;
> 
> 	/* The req and req->next_rq have not been completed */
> 	BUG_ON(blk_end_bidi_request(req, 0, dlen, next_dlen));
> 
> Boaz
>  
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


  reply	other threads:[~2008-10-28 14:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13 17:53 [PATCH 1/2] scsi_transport_fc: FC pass through support via bsg interface - revised Seokmann Ju
2008-10-13 18:14 ` Seokmann Ju
2008-10-14  2:22   ` FUJITA Tomonori
2008-10-14 11:44     ` Seokmann Ju
2008-10-14 13:34       ` FUJITA Tomonori
2008-10-14 14:13         ` Seokmann Ju
2008-10-20 10:59           ` Seokmann Ju
2008-10-20 11:45             ` FUJITA Tomonori
2008-10-20 12:46               ` Seokmann Ju
2008-10-20 13:36                 ` FUJITA Tomonori
2008-10-23  2:27                   ` Seokmann Ju
2008-10-24  3:54                     ` FUJITA Tomonori
2008-10-26  9:38                       ` Boaz Harrosh
2008-10-27  4:12                         ` FUJITA Tomonori
2008-10-27  8:20                           ` Boaz Harrosh
2008-10-27  8:47                             ` FUJITA Tomonori
2008-10-27 16:46                             ` Seokmann Ju
2008-10-28  7:57                               ` Boaz Harrosh
2008-10-28 14:06                                 ` Seokmann Ju
2008-10-28 14:38                                   ` Boaz Harrosh
2008-10-28 14:55                                     ` Boaz Harrosh [this message]
2008-10-28 14:59                                       ` Boaz Harrosh
2008-10-28 16:03                                         ` Seokmann Ju

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=490727E6.6010503@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=James.Smart@Emulex.Com \
    --cc=andrew.vasquez@qlogic.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=jens.axboe@oracle.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.edu \
    --cc=robert.w.love@intel.com \
    --cc=seokmann.ju@qlogic.com \
    /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