All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	viro@ZenIV.linux.org.uk, josef@redhat.com, jeffmerkey@gmail.com
Subject: Re: [PATCH 2/5] fsfreeze: emergency thaw will deadlock on s_umount
Date: Mon, 21 Jun 2010 11:57:31 +1000	[thread overview]
Message-ID: <20100621015731.GJ6590@dastard> (raw)
In-Reply-To: <20100614152011.GB32354@infradead.org>

On Mon, Jun 14, 2010 at 11:20:11AM -0400, Christoph Hellwig wrote:
> On Thu, Jun 10, 2010 at 05:19:51PM +1000, Dave Chinner wrote:
> > The emergency thaw process uses iterate_super() which holds the
> > sb->s_umount lock in read mode. The current thaw_super() code takes
> > the sb->s_umount lock in write mode, hence leading to an instant
> > deadlock.
> > 
> > Pass the emergency state into the thaw_bdev/thaw_super code to avoid
> > taking the s_umount lock in this case. We are running under the bdev
> > freeze mutex, so this is still serialised against freeze despite
> > only having a read lock on the sb->s_umount. Hence it should be safe
> > to execute in this manner, especially given that emergency thaw is a
> > rarely executed "get-out-of-jail" feature.
> 
> This is correct as long as no one calls thaw_super directly, which
> is not the case currently.

This patch doesn't try to deal with the bdev/super mismatches; all
it does is prevent an obvious deadlock. Calling freeze/thaw_super
directly will serialise on the s_umount lock, calling
freeze/thaw_bdev() will serialise on the bdev freeze mutex, and if
we mix the two they'll serialise on the s_umount lock. So I think
with this patch serialisation will still occur correctly but avoid
the current deadlock.

I'll change the commit message to explain this better.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  parent reply	other threads:[~2010-06-21  1:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10  7:19 [RFC, PATCH 0/5] fsfreeze: fix sb vs bdev freeze/thaw b0rkage Dave Chinner
2010-06-10  7:19 ` [PATCH 1/5] fsfreeze: Prevent emergency thaw from looping infinitely Dave Chinner
2010-06-14 15:18   ` Christoph Hellwig
2010-06-14 23:19     ` Dave Chinner
2010-06-10  7:19 ` [PATCH 2/5] fsfreeze: emergency thaw will deadlock on s_umount Dave Chinner
2010-06-14 15:20   ` Christoph Hellwig
2010-06-14 23:21     ` Dave Chinner
2010-06-21  1:57     ` Dave Chinner [this message]
2010-06-21  7:47       ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 3/5] fsfreeze: freeze_super and thaw_bdev don't play well together Dave Chinner
2010-06-14 15:22   ` Christoph Hellwig
2010-06-15  0:01     ` Dave Chinner
2010-06-15  6:24       ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 4/5] fsfreeze: switch to using super methods everywhere Dave Chinner
2010-06-14 15:23   ` Christoph Hellwig
2010-06-10  7:19 ` [PATCH 5/5] fsfreeze: move emergency thaw code to fs/super.c Dave Chinner
2010-06-14 15:25   ` Christoph Hellwig
2010-06-10 12:45 ` [RFC, PATCH 0/5] fsfreeze: fix sb vs bdev freeze/thaw b0rkage Josef Bacik
2010-06-10 12:45   ` Josef Bacik

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=20100621015731.GJ6590@dastard \
    --to=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=jeffmerkey@gmail.com \
    --cc=josef@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.