public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: Lockdep problem involving sysfs_mutex in ext4 in linux-next
Date: Fri, 20 Mar 2009 18:44:58 -0400	[thread overview]
Message-ID: <20090320224458.GC4559@mit.edu> (raw)
In-Reply-To: <20090320222522.GB4559@mit.edu>

On Fri, Mar 20, 2009 at 06:25:22PM -0400, Theodore Tso wrote:
> So if I'm reading this right, the problem is happening because
> someplace in the kernel, fs/sysfs code is grabbing mmap_sem while it
> is holding sysfs_mutex, right?  But I can't see where that might be
> happening...

Never mind, I see it.  sysfs_readdir() calls filldir() while holding
sysfs_mutex, and filldir() in turn calls copy_to_user(), which can
grab mmap_sem.

The problem is that in other code paths, mmap_sem() is grabbed while
we grab inode->i_alloc_sem() (in ext4_page_mkwrite), and that in turns
has a dependency on jbd2_handle, which has a dependency on s_lock, and
hence lock_super().  Ugh.  What a mess.

							- Ted

      reply	other threads:[~2009-03-20 22:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-14 14:02 Lockdep problem involving sysfs_mutex in ext4 in linux-next Theodore Ts'o
2009-03-14 23:05 ` Peter Zijlstra
2009-03-20 22:25   ` Theodore Tso
2009-03-20 22:44     ` Theodore Tso [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=20090320224458.GC4559@mit.edu \
    --to=tytso@mit.edu \
    --cc=gregkh@suse.de \
    --cc=kay.sievers@vrfy.org \
    --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