linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Tejun Heo <tj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ciprian Docan <docan@eden.rutgers.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfs: don't hold s_umount over close_bdev_exclusive() call
Date: Thu, 27 May 2010 05:45:28 +0100	[thread overview]
Message-ID: <20100527044528.GZ31073@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20100525083003.GE23411@kernel.dk>

On Tue, May 25, 2010 at 10:30:03AM +0200, Jens Axboe wrote:
> On Sat, May 22 2010, Tejun Heo wrote:
> > This patch fixes an obscure AB-BA deadlock in get_sb_bdev().
> > 
> > When a superblock is mounted more than once get_sb_bdev() calls
> > close_bdev_exclusive() to drop the extra bdev reference while holding
> > s_umount.  However, sb->s_umount nests inside bd_mutex during
> > __invalidate_device() and close_bdev_exclusive() acquires bd_mutex
> > during blkdev_put(); thus creating an AB-BA deadlock.
> > 
> > This condition doesn't trigger frequently.  For this condition to be
> > visible to lockdep, the filesystem must occupy the whole device (as
> > __invalidate_device() only grabs bd_mutex for the whole device), the
> > FS must be mounted more than once and partition rescan should be
> > issued while the FS is still mounted.
> > 
> > Fix it by dropping s_umount over close_bdev_exclusive().
> 
> Looks safe to me, since it has (as you note) an elevated ref count.

Ehh...  It's probably OK, but I'm worried about the interplay with
->bd_fsfreeze_mutex logics there ;-/

      reply	other threads:[~2010-05-27  4:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20 16:34 possible circular locking dependency detected Ciprian Docan
2010-05-21 21:14 ` Andrew Morton
2010-05-22 14:52   ` [PATCH] vfs: don't hold s_umount over close_bdev_exclusive() call Tejun Heo
2010-05-25  8:30     ` Jens Axboe
2010-05-27  4:45       ` Al Viro [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=20100527044528.GZ31073@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=docan@eden.rutgers.edu \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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 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).