All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: James Bottomley <James.Bottomley@SteelEye.com>,
	Matthew Wilcox <matthew@wil.cx>,
	linux-scsi@vger.kernel.org
Subject: Re: [RFC] [PATCH 1/1] blk request timeout handler patches
Date: Thu, 11 Oct 2007 20:24:32 +0200	[thread overview]
Message-ID: <20071011182430.GC22606@kernel.dk> (raw)
In-Reply-To: <20071011180108.GA15357@us.ibm.com>

On Thu, Oct 11 2007, malahal@us.ibm.com wrote:
> > @@ -3600,24 +3618,132 @@ static struct notifier_block __devinitdata blk_cpu_notifier = {
> >  };
> > 
> >  /**
> > - * blk_complete_request - end I/O on a request
> > - * @req:      the request being processed
> > + * blk_delete_timer - Delete/cancel timer for a given function.
> > + * @req:	request that we are canceling timer for
> >   *
> > - * Description:
> > - *     Ends all I/O on a request. It does not handle partial completions,
> > - *     unless the driver actually implements this in its completion callback
> > - *     through requeueing. Theh actual completion happens out-of-order,
> > - *     through a softirq handler. The user must have registered a completion
> > - *     callback through blk_queue_softirq_done().
> > - **/
> > + * Return value:
> > + *     1 if we were able to detach the timer.  0 if we blew it, and the
> > + *     timer function has already started to run.
> > + */
> > +int blk_delete_timer(struct request *req)
> > +{
> > +	if (!req->q->rq_timed_out_fn)
> > +		return 1;
> > 
> > -void blk_complete_request(struct request *req)
> > +	if (!list_empty(&req->timeout_list)) {
> 
> This could race with timeout handler. In other words, this routine may
> return 1 while blk_rq_timed_out() is running on the request.

My current code is fine, it deletes the request from the list before
calling blk_rq_timed_out().

> > +	ret = q->rq_timed_out_fn(req);
> > +	switch (ret) {
> > +	case BLK_EH_HANDLED:
> > +		__blk_complete_request(req);
> > +		break;
> > +	case BLK_EH_RESET_TIMER:
> > +		blk_add_timer(req);
> 
> You will need to delete the req from the timeout_list before calling
> blk_add_timer again. You may need to remove the req from the list in
> other cases too.

Yep, that is exactly what I did.

-- 
Jens Axboe


  reply	other threads:[~2007-10-11 18:24 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04 18:12 [RFC] [PATCH 0/2] blk request timeout handler patches malahal
2007-10-04 18:17 ` [RFC] [PATCH 1/2] " malahal
2007-10-04 18:52   ` Randy Dunlap
2007-10-04 20:40   ` Salyzyn, Mark
2007-10-05 12:49   ` Jens Axboe
2007-10-08  6:54     ` malahal
2007-10-08  7:04       ` Jens Axboe
2007-10-09  5:36     ` [RFC] [PATCH 1/1] " malahal
2007-10-09  9:14       ` Jens Axboe
2007-10-09 14:26         ` malahal
2007-10-09 12:00       ` Matthew Wilcox
2007-10-09 12:15         ` Jens Axboe
2007-10-09 15:56           ` James Bottomley
2007-10-09 17:23             ` malahal
2007-10-10 12:25             ` Jens Axboe
2007-10-10 16:58               ` malahal
2007-10-10 17:04                 ` Jens Axboe
2007-10-11 18:01               ` malahal
2007-10-11 18:24                 ` Jens Axboe [this message]
2007-10-11 18:33                   ` Jens Axboe
2007-10-23  1:45                     ` malahal
2007-10-23  6:30                       ` malahal
2007-10-23 11:59                       ` Jens Axboe
2007-10-05 12:50   ` [RFC] [PATCH 1/2] " Jens Axboe
2007-10-04 18:20 ` [RFC] [PATCH 2/2] " malahal
2007-10-04 18:32   ` Randy Dunlap

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=20071011182430.GC22606@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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.