All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Kommu <kommu@hotmail.com>
To: linux-kernel@vger.kernel.org
Cc: Srinivas Kommu <kommu@hotmail.com>
Subject: driver spin lock and files_lock deadlock question
Date: Thu, 20 Dec 2007 22:59:20 -0800	[thread overview]
Message-ID: <476B6448.7090805@hotmail.com> (raw)

I have a driver that needs to be SMP-safe. It also has some code hooking 
into the net_rx_action softirq. So it takes a spinlock and disables the 
local bottom-half around its critical sections: 
spin_lock_bh(&driver_lock). Now, I'm facing a deadlock under a 
particular sequence involving the files_lock:

1. CPU 0 takes driver_lock and then calls remove_proc_entry() which is 
hanging at spin_lock(&files_lock).

2. CPU 1 was in fput() which took files_lock; the softirq comes in at 
this point and attempts to take driver_lock and hangs forever.

It seems this kind of a deadlock can happen with any kernel lock, not 
just files_lock. What's the driver's mistake here? Is it wrong to call 
remove_proc_entry() while holding another lock? What is the right thing 
to do?

This is with the 2.4 kernel, BTW.


thanks
srini

             reply	other threads:[~2007-12-21  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-21  6:59 Srinivas Kommu [this message]
2007-12-21  7:17 ` driver spin lock and files_lock deadlock question Al Viro

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=476B6448.7090805@hotmail.com \
    --to=kommu@hotmail.com \
    --cc=linux-kernel@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.