public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Josh Boyer <jwboyer@gmail.com>
Cc: "Justin P. Mattock" <justinmattock@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: INFO: possible circular locking dependency detected 3.1.0-rc2-00190-g3210d19
Date: Mon, 22 Aug 2011 14:56:04 +0100	[thread overview]
Message-ID: <20110822135604.GU2203@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CA+5PVA5NE1Om9SK-UoA-RBH56RP-MLrNdiMVAVQx8LFaBdxaYg@mail.gmail.com>

On Mon, Aug 22, 2011 at 09:33:34AM -0400, Josh Boyer wrote:

> So the lockdep report in the RHBZ (which now that I look at it
> probably isn't the same as this report) seems to be doing a readdir
> while find is trying to mmap, which is calling into
> hugetlbfs_file_mmap and throwing the same deadlock warning.  Is that
> like the scenario you are describing above?

Lockdep records the first trace that leads to locks taken in this
order.  readdir() seems to be the first thing to step on i_mutex
and mmap_sem (not too surprisingly, come to think of that - directory
reads happening earlier in the boot than regular file writes).

So when it reports i_mutex taken under mmap_sem, readdir gets mentioned
by lockdep.  Often leading to comments along the lines of "but this
inode is not a directory at all; shouldn't we relax the rules for
non-directories?"  Nope; the same ordering very much applies to regular
files.  With s/readdir/write/.

The bottom line is: don't take i_mutex while holding mmap_sem.  Really.

  reply	other threads:[~2011-08-22 13:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22  3:41 INFO: possible circular locking dependency detected 3.1.0-rc2-00190-g3210d19 Justin P. Mattock
2011-08-22 13:09 ` Josh Boyer
2011-08-22 13:16   ` Al Viro
2011-08-22 13:27     ` Josh Boyer
2011-08-22 13:27     ` Al Viro
2011-08-22 13:33       ` Josh Boyer
2011-08-22 13:56         ` Al Viro [this message]
2011-08-22 15:24           ` Josh Boyer

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=20110822135604.GU2203@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=justinmattock@gmail.com \
    --cc=jwboyer@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox