From: Russell King <rmk@arm.linux.org.uk>
To: Nikita Danilov <Nikita@Namesys.COM>
Cc: Linux Kernel Mailing List <Linux-Kernel@Vger.Kernel.ORG>,
Andrew Morton <AKPM@Digeo.COM>,
Alexander Viro <viro@math.psu.edu>
Subject: Re: possible deadlock in sys_pivot_root()?
Date: Mon, 27 Jan 2003 15:12:13 +0000 [thread overview]
Message-ID: <20030127151213.B28375@flint.arm.linux.org.uk> (raw)
In-Reply-To: <15925.15947.576552.209252@laputa.namesys.com>; from Nikita@Namesys.COM on Mon, Jan 27, 2003 at 05:12:27PM +0300
On Mon, Jan 27, 2003 at 05:12:27PM +0300, Nikita Danilov wrote:
> sys_pivot_root() first takes BKL, then ->i_sem on the old root
> directory. On the other hand, vfs_readdir() first takes ->i_sem on a
> directory and then calls file system ->readdir() method, that usually
> takes BKL. Isn't there a deadlock possibility? Of course,
> sys_pivot_root() is probably not supposed to be called frequently, but
> still.
No, you can't deadlock here. When you get contention on the i_sem,
one thread will be put to sleep, and when that happens, the BKL will
be automatically released.
So:
CPU0 CPU1
BKL
i_sem
BKL (spins, waiting for BKL to be released)
i_sem (finds it locked,
and sleeps, which
releases the BKL)
(BKL is now released, CPU1 continues)
--
Russell King (rmk@arm.linux.org.uk) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html
prev parent reply other threads:[~2003-01-27 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-27 14:12 possible deadlock in sys_pivot_root()? Nikita Danilov
2003-01-27 15:04 ` Nikita Danilov
2003-01-27 15:12 ` Russell King [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=20030127151213.B28375@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=AKPM@Digeo.COM \
--cc=Linux-Kernel@Vger.Kernel.ORG \
--cc=Nikita@Namesys.COM \
--cc=viro@math.psu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox