linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Benjamin Marzinski <bmarzins@redhat.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: [RFC] fs: move freeze/unfreeze_fs hooks before freeze/thaw_super
Date: Wed, 24 Sep 2014 06:50:48 +1000	[thread overview]
Message-ID: <20140923205048.GS4267@dastard> (raw)
In-Reply-To: <20140923132423.GA10973@ask-08.lab.msp.redhat.com>

[please don't top post]

On Tue, Sep 23, 2014 at 08:24:23AM -0500, Benjamin Marzinski wrote:
> On Tue, Sep 23, 2014 at 11:38:59PM +1000, Dave Chinner wrote:
> > On Mon, Sep 22, 2014 at 09:06:41PM -0500, Benjamin Marzinski wrote:
> > > Currently, freezing a filesystem involves calling freeze_super, which locks
> > > sb->s_umount and then calls the fs-specific freeze_fs hook. This makes it
> > > hard for gfs2 (and potentially other cluster filesystems) to use the vfs
> > > freezing code to do freezes on all the cluster nodes.
> > > 
> > > In order to communicate that a freeze has been requested, and to make sure
> > > that only one node is trying to freeze at a time, gfs2 uses a glock
> > > (sd_freeze_gl). The problem is that there is no hook for gfs2 to acquire
> > > this lock before calling freeze_super. This means that two nodes can
> > > attempt to freeze the filesystem by both calling freeze_super, acquiring
> > > the sb->s_umount lock, and then attempting to grab the cluster glock
> > > sd_freeze_gl. Only one will succeed, and the other will be stuck in
> > > freeze_super, making it impossible to finish freezing the node.
> > > 
> > > To solve this problem, this patch pushes the freeze/unfreeze_fs hooks to
> > > before freeze/thaw_super, and makes freeze/thaw_super take a callback
> > > function to execute any fs specific code that needs to be done while
> > > s_umount is held. This also means that every filesystem that implements
> > > freeze/unfreeze_fs must call freeze/thaw_super from that function.
> > 
> > Wouldn't just adding a ->prepare_freeze/->prepare_thaw method pair
> > and adding gfs2 cluster locking to those new methods be better?
> > That way no other filesystem code needs to change at all...
> 
> That way would certainly require fewer changes. But it seemed to me like
> adding a pair of hooks that only gfs2 needed would have less support. If
> people would prefer a patch like that, I can easily change it.

It's much better than changing the meaning and usage of an existing
method and silently breaking every out-of-tree module that uses the
freezefs/unfreezefs methods. Adding new methods is simple, these new
methods have very little impact on the structure and logic of the
code, and it can be ignored by the majority of filesystems. Seems
like the right thing to do to me...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2014-09-23 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-23  2:06 [RFC] fs: move freeze/unfreeze_fs hooks before freeze/thaw_super Benjamin Marzinski
2014-09-23 13:38 ` Dave Chinner
2014-09-23 13:24   ` Benjamin Marzinski
2014-09-23 20:50     ` Dave Chinner [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=20140923205048.GS4267@dastard \
    --to=david@fromorbit.com \
    --cc=bmarzins@redhat.com \
    --cc=linux-fsdevel@vger.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).