From: Jens Axboe <jens.axboe@oracle.com>
To: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ciprian Docan <docan@eden.rutgers.edu>,
linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] vfs: don't hold s_umount over close_bdev_exclusive() call
Date: Tue, 25 May 2010 10:30:03 +0200 [thread overview]
Message-ID: <20100525083003.GE23411@kernel.dk> (raw)
In-Reply-To: <4BF7EFA4.4050901@kernel.org>
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.
Acked-by: Jens Axboe <jens.axboe@oracle.com>
--
Jens Axboe
next prev parent reply other threads:[~2010-05-25 8:30 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 [this message]
2010-05-27 4:45 ` Al Viro
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=20100525083003.GE23411@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=docan@eden.rutgers.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
--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).