2019-05-31 10:09:56 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2006-01-16 17:50:04 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
2006-05-18 21:09:15 +02:00
|
|
|
* Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
|
2006-01-16 17:50:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GLOPS_DOT_H__
|
|
|
|
#define __GLOPS_DOT_H__
|
|
|
|
|
2006-09-05 16:39:21 +02:00
|
|
|
#include "incore.h"
|
|
|
|
|
2014-11-14 03:42:04 +01:00
|
|
|
extern struct workqueue_struct *gfs2_freeze_wq;
|
|
|
|
|
2006-08-30 15:30:00 +02:00
|
|
|
extern const struct gfs2_glock_operations gfs2_meta_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_inode_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_rgrp_glops;
|
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-02 05:26:55 +02:00
|
|
|
extern const struct gfs2_glock_operations gfs2_freeze_glops;
|
2006-08-30 15:30:00 +02:00
|
|
|
extern const struct gfs2_glock_operations gfs2_iopen_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_flock_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_nondisk_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_quota_glops;
|
|
|
|
extern const struct gfs2_glock_operations gfs2_journal_glops;
|
GFS2: Add a "demote a glock" interface to sysfs
This adds a sysfs file called demote_rq to GFS2's
per filesystem directory. Its possible to use this
file to demote arbitrary glocks in exactly the same
way as if a request had come in from a remote node.
This is intended for testing issues relating to caching
of data under glocks. Despite that, the interface is
generic enough to send requests to any type of glock,
but be careful as its not always safe to send an
arbitrary message to an arbitrary glock. For that reason
and to prevent DoS, this interface is restricted to root
only.
The messages look like this:
<type>:<glocknumber> <mode>
Example:
echo -n "2:13324 EX" >/sys/fs/gfs2/unity:myfs/demote_rq
Which means "please demote inode glock (type 2) number 13324 so that
I can get an EX (exclusive) lock". The lock modes are those which
would normally be sent by a remote node in its callback so if you
want to unlock a glock, you use EX, to demote to shared, use SH or PR
(depending on whether you like GFS2 or DLM lock modes better!).
If the glock doesn't exist, you'll get -ENOENT returned. If the
arguments don't make sense, you'll get -EINVAL returned.
The plan is that this interface will be used in combination with
the blktrace patch which I recently posted for comments although
it is, of course, still useful in its own right.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
2009-02-12 14:31:58 +01:00
|
|
|
extern const struct gfs2_glock_operations *gfs2_glops_list[];
|
2006-01-16 17:50:04 +01:00
|
|
|
|
2011-09-07 11:33:25 +02:00
|
|
|
extern void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync);
|
2011-04-14 10:54:02 +02:00
|
|
|
|
2006-01-16 17:50:04 +01:00
|
|
|
#endif /* __GLOPS_DOT_H__ */
|