linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. R. Okajima" <hooanon05@yahoo.co.jp>
To: Al Viro <viro@zeniv.linux.org.uk>,
	Christoph Hellwig <hch@infradead.org>,
	Nick Piggin <npiggin@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Q. locking order of dcache_lru_lock
Date: Fri, 08 Apr 2011 22:20:31 +0900	[thread overview]
Message-ID: <9769.1302268831@jrobl> (raw)


Hello Al Viro, Christoph Hellwig and Nick Piggin,

I have a question about the locking order of dcache_lru_lock.

The comment in fs/dcache.c says
 * Ordering:
 * dentry->d_inode->i_lock
 *   dentry->d_lock
 *     dcache_lru_lock
	:::

d_lock should be before dcache_lru_lock.
Actually dentry_lru_(add|del|move_tail) functions (and their callers) do
it expectedly.
But __shrink_dcache_sb() looks different.

__shrink_dcache_sb()
{
	:::
relock:
	spin_lock(&dcache_lru_lock);
	while (!list_empty(&sb->s_dentry_lru)) {
		::
		if (!spin_trylock(&dentry->d_lock)) {
			spin_unlock(&dcache_lru_lock);
			cpu_relax();
			goto relock;
		}
	:::
}

When spin_trylock(&dentry->d_lock) successfully acquired d_lock, does
the violation of locking order happen (or a deadlock, in worse case)?

By the way, the code is introduced by the commit
	2304450 2011-01-07 fs: dcache scale lru
by Nick Piggin.
Is he allright? Does anyone know anything?
We have not received from him for a long time.


J. R. Okajima

             reply	other threads:[~2011-04-08 13:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-08 13:20 J. R. Okajima [this message]
2011-04-09 17:12 ` Q. locking order of dcache_lru_lock Peter Zijlstra
2011-04-11  5:09   ` J. R. Okajima
2011-04-11  6:27     ` Dave Chinner
2011-04-11  8:30     ` Peter Zijlstra
2011-04-11 12:33       ` J. R. Okajima
2011-04-11 12:41         ` Peter Zijlstra

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=9769.1302268831@jrobl \
    --to=hooanon05@yahoo.co.jp \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).