public inbox for linux-fsdevel@vger.kernel.org
 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 v2] fs: add prepare_freeze/prepare_thaw fs hooks
Date: Thu, 25 Sep 2014 11:42:24 +1000	[thread overview]
Message-ID: <20140925014224.GE4945@dastard> (raw)
In-Reply-To: <1411585318-20922-1-git-send-email-bmarzins@redhat.com>

On Wed, Sep 24, 2014 at 02:01:58PM -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 adds the prepare_freeze prepare_thaw
> hooks.  If a filesystem implements these hooks, they are called instead of
> freeze_super and thaw_super. This means that every filesystem that
> implements prepare_freeze/thaw must call freeze/thaw_super within that
> function to make use of the vfs freezing code.

Why instead? The filesystem still have to call
freeze_super/thaw_super() after "prepare".

> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> ---
>  fs/block_dev.c     | 10 ++++++++--
>  fs/ioctl.c         |  6 +++++-
>  include/linux/fs.h |  2 ++
>  3 files changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 6d72746..f931412 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -245,7 +245,10 @@ struct super_block *freeze_bdev(struct block_device *bdev)
>  	sb = get_active_super(bdev);
>  	if (!sb)
>  		goto out;
> -	error = freeze_super(sb);
> +	if (sb->s_op->prepare_freeze)
> +		error = sb->s_op->prepare_freeze(sb);
> +	else
> +		error = freeze_super(sb);

I was proposing this callout to be like this:

	if (sb->s_op->prepare_freeze)
		error = sb->s_op->prepare_freeze(sb);
	if (!error)
		error = freeze_super(sb);
	if (error) {
		....

i.e. prepare() does all the filesystem specific preparation,
everything else goes through the normal freeze code.  The lack of
gfs2 specific patches showing how gfs2 is going to use this
interface is not helping here...

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2014-09-25  1:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 19:01 [RFC v2] fs: add prepare_freeze/prepare_thaw fs hooks Benjamin Marzinski
2014-09-25  1:42 ` Dave Chinner [this message]
2014-09-29 16:58   ` Benjamin Marzinski
2014-09-30  9:47     ` Jan Kara

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=20140925014224.GE4945@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