All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Prashant <0xfffff0@gmail.com>
Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: spinlock recursion in scsi_end_request() (kernel 2.6.24)
Date: Thu, 20 May 2010 17:05:19 +0200	[thread overview]
Message-ID: <4BF54FAF.6020104@kernel.org> (raw)
In-Reply-To: <AANLkTilPaI-b4IUNfUnVKahK299fujgYTXsxC1BROw0L@mail.gmail.com>

Hello,

On 05/20/2010 01:33 PM, Prashant wrote:
> I have a question related to code which is almost same in the
> current kernel.  I don't know whether this is the right mailing list
> for the following question.

linux-scsi would probably fit better (cc'd).

> When a sata drive is unplugged, its corresponding sdev's state is set
> to SDEV_OFFLINE. Now if IO requests are still comming on the same device,
> They will be killed by calling scsi_kill_request().
> 
> 1) scsi_kill_request does following things:
>     i) Unlock request queue
>     ii) Increment host_busy count
>     iii) Lock request queue
>     iv) Calls __scsi_done()
> 
> 2) __scsi_done() does following things:
>      i) set request completion data
>      ii) Calls blk_completion_request()
> 
> 3) blk_completion_request() does following things:
>      i) Adds request->donelist to blk_cpu_done softirq queue
>         and raise the softirq (which is scsi_softirq_done)
> 
> 4) next sequence is:
>     scsi_softirq_done >> scsi_finish_command >> scsi_device_unbusy()
> 
> 5) scsi_device_unbusy() again locks the request_queue. This is the place where
>     we can get into the spinlock recursion.
> 
>     Is this correct? Please correct me if something is wrong.

Raising softirq defers the work to another context and grabbing the
same lock from softirq handler doesn't constitute a recursive locking.
Please try to reproduce the problem on recent kernel w/ lockdep
enabled.

Thanks.

-- 
tejun

  reply	other threads:[~2010-05-20 15:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-17 11:32 spinlock recursion in scsi_end_request() (kernel 2.6.24) Prashant
2010-05-20 10:02 ` Tejun Heo
2010-05-20 11:33   ` Prashant
2010-05-20 15:05     ` Tejun Heo [this message]
2010-05-20 15:29       ` James Bottomley
2010-05-21 15:19         ` Prashant

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=4BF54FAF.6020104@kernel.org \
    --to=tj@kernel.org \
    --cc=0xfffff0@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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.