aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/glock.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2009-02-12 08:31:58 -0500
committerSteven Whitehouse <steve@dolmen.chygwyn.com>2009-03-24 07:21:22 -0400
commit64d576ba23bfd9b770cbb0279200f479272eb859 (patch)
tree8c119b0e45d288035fc24fd43cf5286da1947fb1 /fs/gfs2/glock.c
parent02e3cc70ecbd4352ae4d26459929f43ab1547251 (diff)
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>
Diffstat (limited to 'fs/gfs2/glock.c')
-rw-r--r--fs/gfs2/glock.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index ad8e121427c0..3984e47d1d33 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -684,10 +684,11 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
684 gl = search_bucket(hash, sdp, &name); 684 gl = search_bucket(hash, sdp, &name);
685 read_unlock(gl_lock_addr(hash)); 685 read_unlock(gl_lock_addr(hash));
686 686
687 if (gl || !create) { 687 *glp = gl;
688 *glp = gl; 688 if (gl)
689 return 0; 689 return 0;
690 } 690 if (!create)
691 return -ENOENT;
691 692
692 gl = kmem_cache_alloc(gfs2_glock_cachep, GFP_KERNEL); 693 gl = kmem_cache_alloc(gfs2_glock_cachep, GFP_KERNEL);
693 if (!gl) 694 if (!gl)