linux/fs/gfs2
Benjamin Marzinski 24972557b1 GFS2: remove transaction glock
GFS2 has a transaction glock, which must be grabbed for every
transaction, whose purpose is to deal with freezing the filesystem.
Aside from this involving a large amount of locking, it is very easy to
make the current fsfreeze code hang on unfreezing.

This patch rewrites how gfs2 handles freezing the filesystem. The
transaction glock is removed. In it's place is a freeze glock, which is
cached (but not held) in a shared state by every node in the cluster
when the filesystem is mounted. This lock only needs to be grabbed on
freezing, and actions which need to be safe from freezing, like
recovery.

When a node wants to freeze the filesystem, it grabs this glock
exclusively.  When the freeze glock state changes on the nodes (either
from shared to unlocked, or shared to exclusive), the filesystem does a
special log flush.  gfs2_log_flush() does all the work for flushing out
the and shutting down the incore log, and then it tries to grab the
freeze glock in a shared state again.  Since the filesystem is stuck in
gfs2_log_flush, no new transaction can start, and nothing can be written
to disk. Unfreezing the filesytem simply involes dropping the freeze
glock, allowing gfs2_log_flush() to grab and then release the shared
lock, so it is cached for next time.

However, in order for the unfreezing ioctl to occur, gfs2 needs to get a
shared lock on the filesystem root directory inode to check permissions.
If that glock has already been grabbed exclusively, fsfreeze will be
unable to get the shared lock and unfreeze the filesystem.

In order to allow the unfreeze, this patch makes gfs2 grab a shared lock
on the filesystem root directory during the freeze, and hold it until it
unfreezes the filesystem.  The functions which need to grab a shared
lock in order to allow the unfreeze ioctl to be issued now use the lock
grabbed by the freeze code instead.

The freeze and unfreeze code take care to make sure that this shared
lock will not be dropped while another process is using it.

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2014-05-14 10:04:34 +01:00
..
acl.c GFS2: inline function gfs2_set_mode 2014-03-19 15:53:52 +00:00
acl.h GFS2: Increase the max number of ACLs 2014-03-19 15:16:24 +00:00
aops.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
bmap.c GFS2: Clean up journal extent mapping 2014-03-03 13:50:12 +00:00
bmap.h GFS2: Clean up journal extent mapping 2014-03-03 13:50:12 +00:00
dentry.c gfs2: use check_submounts_and_drop() 2013-09-05 16:23:51 -04:00
dir.c GFS2: Use pr_<level> more consistently 2014-03-07 09:30:51 +00:00
dir.h GFS2: Remember directory insert point 2014-01-06 12:49:43 +00:00
export.c [readdir] constify ->actor 2013-06-29 12:57:05 +04:00
file.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
gfs2.h [GFS2] Remove remote lock dropping code 2008-06-27 09:39:44 +01:00
glock.c GFS2: Ensure workqueue is scheduled after noexp request 2014-03-12 14:45:48 +00:00
glock.h GFS2: Don't use ENOBUFS when ENOMEM is the correct error code 2014-01-16 10:31:13 +00:00
glops.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
glops.h GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
incore.h GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
inode.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
inode.h GFS2: Add atomic_open support 2013-06-14 11:17:15 +01:00
Kconfig Finally eradicate CONFIG_HOTPLUG 2013-06-03 14:20:18 -07:00
lock_dlm.c GFS2: Use pr_<level> more consistently 2014-03-07 09:30:51 +00:00
log.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
log.h GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
lops.c GFS2: lops.c: replace 0 by NULL for pointers 2014-04-28 09:41:55 +01:00
lops.h GFS2: Move log buffer lists into transaction 2014-02-24 16:54:54 +00:00
main.c GFS2: Use pr_<level> more consistently 2014-03-07 09:30:51 +00:00
Makefile GFS2: Rename ops_inode.c to inode.c 2011-05-10 13:12:49 +01:00
meta_io.c GFS2: Fix address space from page function 2014-03-31 17:48:27 +01:00
meta_io.h GFS2: Fix address space from page function 2014-03-31 17:48:27 +01:00
ops_fstype.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
quota.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
quota.h GFS2: Use RCU/hlist_bl based hash for quotas 2014-01-14 19:27:56 +00:00
recovery.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
recovery.h GFS2: Move recovery variables to journal structure in memory 2014-03-07 09:14:48 +00:00
rgrp.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
rgrp.h GFS2: Don't use ENOBUFS when ENOMEM is the correct error code 2014-01-16 10:31:13 +00:00
super.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
super.h GFS2: Clean up freeze code 2013-01-29 10:29:05 +00:00
sys.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
sys.h GFS2: dlm based recovery coordination 2012-01-11 09:23:05 +00:00
trace_gfs2.h GFS2: Add origin indicator to glock demote tracing 2013-04-10 10:32:05 +01:00
trans.c GFS2: remove transaction glock 2014-05-14 10:04:34 +01:00
trans.h GFS2: Split gfs2_trans_add_bh() into two 2013-01-29 10:28:04 +00:00
util.c GFS2: Convert gfs2_lm_withdraw to use fs_err 2014-03-07 09:39:18 +00:00
util.h GFS2: Convert gfs2_lm_withdraw to use fs_err 2014-03-07 09:39:18 +00:00
xattr.c gfs2: use generic posix ACL infrastructure 2014-01-25 23:58:22 -05:00
xattr.h sanitize xattr handler prototypes 2009-12-16 12:16:49 -05:00