All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Eykholt <jeykholt@cisco.com>
To: Mike Christie <michaelc@cs.wisc.edu>
Cc: Linux SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: sd_ref_mutex and cpu_add_remove_lock deadlock
Date: Thu, 25 Jun 2009 11:14:55 -0700	[thread overview]
Message-ID: <4A43BE9F.2000804@cisco.com> (raw)
In-Reply-To: <4A4396C7.2030106@cs.wisc.edu>

Mike Christie wrote:
> On 06/24/2009 11:06 PM, Joe Eykholt wrote:
>> Has anyone seen this?
>>
>> I'm getting a hang due to three threads in a deadly
>> embrace involving two mutexes.
>>
>> A user process doing a close on /dev/sdx has the sd_ref_mutex
>> and is trying to get cpu_add_remove_lock.
>>
>> Another process is doing a /sys write to destroy an fcoe
>> instance. It is in destroy_workqueue() which holds the
>> cpu_add_remove_lock() waiting for a work item to complete.
>>
>> The third thread is running the work item, and waiting on
>> the sd_ref_mutex.
>>
>> To summarize:
>> Worker thread wants sd_ref_mutex
>> Close thread has sd_ref_mutex and wants cpu_add_remove_lock
>> Destroy thread has cpu_add_remove_lock and waits
>> for worker_thread to exit.
>>
>> The stacks are shown below.
>>
>> I'm not sure what the best solution would be or which
>> locking rule is being broken here.
>>
>> Also, it seems to me there's a possible deadlock where
>> sd_remove() has the sd_ref_mutex locked and is doing a
>> put_device(). The release function for this device is
>> scsi_disc_release(), which also takes the sd_ref_mutex().
>> Maybe it's known that this can't be the last put_device().
>>
>> This is based on the open-fcoe.org fcoe-next.git tree, which is
>> fairly up-to-date.
>>
> 
> I think I am seeing a similar warning from the lock dependency checking. 
> I just started seeing it. Have you seen yours in older kernels?

No, just this once.

	Joe


      reply	other threads:[~2009-06-25 18:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-25  4:06 sd_ref_mutex and cpu_add_remove_lock deadlock Joe Eykholt
2009-06-25 15:24 ` Mike Christie
2009-06-25 18:14   ` Joe Eykholt [this message]

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=4A43BE9F.2000804@cisco.com \
    --to=jeykholt@cisco.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=michaelc@cs.wisc.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 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.