cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH 0/2] new vfs freeze hooks and gfs2 freeze rewrite
@ 2014-10-13 22:31 Benjamin Marzinski
  2014-10-13 22:31 ` [Cluster-devel] [PATCH 1/2] fs: add freeze_super/thaw_super fs hooks Benjamin Marzinski
  2014-10-13 22:31 ` [Cluster-devel] [PATCH 2/2] gfs2: update freeze code to use freeze/thaw_super on all nodes Benjamin Marzinski
  0 siblings, 2 replies; 4+ messages in thread
From: Benjamin Marzinski @ 2014-10-13 22:31 UTC (permalink / raw)
  To: cluster-devel.redhat.com

The existing gfs2 freeze code can't properly make use the kernel vfs
freezing code on all the nodes of a cluster. This is because the only hook
into the gfs2 freeze code comes inside of freeze_super, which holds the
sb->s_umount lock. In order to notify the other nodes in the cluster to
freeze the filesystem, gfs2 must grab a glock. Thus, if two nodes tried to
freeze the filesystem at the same time and all cluster nodes used
freeze_super to enforce the freeze, both nodes would first grab the
sb->s_umount lock in freeze_super, and then they would race to grab the
gfs2 freeze glock. The loser would be stuck in freeze_super, waiting on the
freeze glock. This means that gfs2 can't rely on freezing all the nodes in
the cluster by calling freeze_super, because one node would already be
stuck in that function with sb->s_umount held. So, currently gfs2 only
calls freeze_super on the node that initiates the freeze and deals with
blocking the writes entirely within the gfs2 code. This involves some
pretty hacky code.

To fix this, the first patch of this patchset adds two new vfs hooks,
freeze_super and thaw_super.  If a filesystem implements these hooks, they
will be called instead of the vfs freeze_super and thaw_super functions.
The second patch of this set makes use of these hooks to simplify the gfs2
freezing code. This allows gfs2 to grab the freeze glock first and call the
actual vfs freeze functions in response to node grabbing the freeze glock.
Thus, all nodes can use the vfs freeze_super and thaw_super code to freeze
the filesystem.

The current hook names were suggested by Jan Kara, over my original
prepare_freeeze and prepare_thaw names, which were more confusing.

Benjamin Marzinski (2):
  fs: add freeze_super/thaw_super fs hooks
  gfs2: update freeze code to use freeze/thaw_super on all nodes

 fs/block_dev.c       |  10 ++++-
 fs/gfs2/glops.c      |  26 ++++++-------
 fs/gfs2/glops.h      |   2 +
 fs/gfs2/incore.h     |  15 +++++---
 fs/gfs2/inode.c      |  40 +++++---------------
 fs/gfs2/log.c        |  29 ++++++---------
 fs/gfs2/main.c       |  11 +++++-
 fs/gfs2/ops_fstype.c |  16 ++------
 fs/gfs2/super.c      | 101 ++++++++++++++++++++++++++++++++++-----------------
 fs/gfs2/super.h      |   1 +
 fs/gfs2/trans.c      |  17 +++++++--
 fs/ioctl.c           |   6 ++-
 include/linux/fs.h   |   2 +
 13 files changed, 154 insertions(+), 122 deletions(-)

-- 
1.9.3



^ permalink raw reply	[flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH 0/2 v2] new vfs freeze hooks and gfs2 freeze rewrite
@ 2014-11-14  2:42 Benjamin Marzinski
  2014-11-14  2:42 ` [Cluster-devel] [PATCH 1/2] fs: add freeze_super/thaw_super fs hooks Benjamin Marzinski
  0 siblings, 1 reply; 4+ messages in thread
From: Benjamin Marzinski @ 2014-11-14  2:42 UTC (permalink / raw)
  To: cluster-devel.redhat.com

The existing gfs2 freeze code can't properly make use the kernel vfs
freezing code on all the nodes of a cluster. This is because the only hook
into the gfs2 freeze code comes inside of freeze_super, which holds the
sb->s_umount lock. In order to notify the other nodes in the cluster to
freeze the filesystem, gfs2 must grab a glock. Thus, if two nodes tried to
freeze the filesystem at the same time and all cluster nodes used
freeze_super to enforce the freeze, both nodes would first grab the
sb->s_umount lock in freeze_super, and then they would race to grab the
gfs2 freeze glock. The loser would be stuck in freeze_super, waiting on the
freeze glock. This means that gfs2 can't rely on freezing all the nodes in
the cluster by calling freeze_super, because one node would already be
stuck in that function with sb->s_umount held. So, currently gfs2 only
calls freeze_super on the node that initiates the freeze and deals with
blocking the writes entirely within the gfs2 code. This involves some
pretty hacky code.

To fix this, the first patch of this patchset adds two new vfs hooks,
freeze_super and thaw_super.  If a filesystem implements these hooks, they
will be called instead of the vfs freeze_super and thaw_super functions.
The second patch of this set makes use of these hooks to simplify the gfs2
freezing code. This allows gfs2 to grab the freeze glock first and call the
actual vfs freeze functions in response to node grabbing the freeze glock.
Thus, all nodes can use the vfs freeze_super and thaw_super code to freeze
the filesystem. This vesion also fixes some issues with a race between
reserving log space and making the filesystem read-only.

The current hook names were suggested by Jan Kara, over my original
prepare_freeeze and prepare_thaw names, which were more confusing.

Benjamin Marzinski (2):
  fs: add freeze_super/thaw_super fs hooks
  gfs2: update freeze code to use freeze/thaw_super on all nodes

 fs/block_dev.c       |  10 ++++-
 fs/gfs2/glops.c      |  26 ++++++------
 fs/gfs2/glops.h      |   2 +
 fs/gfs2/incore.h     |  18 ++++++---
 fs/gfs2/inode.c      |  40 +++++-------------
 fs/gfs2/log.c        |  42 +++++++++----------
 fs/gfs2/main.c       |  11 ++++-
 fs/gfs2/ops_fstype.c |  18 +++------
 fs/gfs2/super.c      | 112 ++++++++++++++++++++++++++++++++++-----------------
 fs/gfs2/super.h      |   1 +
 fs/gfs2/trans.c      |  17 ++++++--
 fs/ioctl.c           |   6 ++-
 include/linux/fs.h   |   2 +
 13 files changed, 176 insertions(+), 129 deletions(-)

-- 
1.9.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-11-14  2:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-13 22:31 [Cluster-devel] [PATCH 0/2] new vfs freeze hooks and gfs2 freeze rewrite Benjamin Marzinski
2014-10-13 22:31 ` [Cluster-devel] [PATCH 1/2] fs: add freeze_super/thaw_super fs hooks Benjamin Marzinski
2014-10-13 22:31 ` [Cluster-devel] [PATCH 2/2] gfs2: update freeze code to use freeze/thaw_super on all nodes Benjamin Marzinski
  -- strict thread matches above, loose matches on Subject: below --
2014-11-14  2:42 [Cluster-devel] [PATCH 0/2 v2] new vfs freeze hooks and gfs2 freeze rewrite Benjamin Marzinski
2014-11-14  2:42 ` [Cluster-devel] [PATCH 1/2] fs: add freeze_super/thaw_super fs hooks Benjamin Marzinski

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).