summaryrefslogtreecommitdiff
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-02-15 10:15:18 +0000
committerSteven Whitehouse <swhiteho@redhat.com>2006-02-15 10:15:18 +0000
commit61a30dcb5866eb7e92796b2988ddb4c94b9f78ac (patch)
treeaa27ef185437a813041aae3e9f0aa403a960db43 /fs/gfs2/ops_address.c
parent4dd651adbb4898d3200426c197b26c99d2209d8d (diff)
downloadlwn-61a30dcb5866eb7e92796b2988ddb4c94b9f78ac.tar.gz
lwn-61a30dcb5866eb7e92796b2988ddb4c94b9f78ac.zip
[GFS2] Fix for lock recursion problem for internal files
Two internal files which are read through the gfs2_internal_read() routine were already locked when the routine was called and this do not need locking at the redapages level. This patch introduces a struct file which is used as a sentinal so that readpage will only perform locking in the case that the struct file passed to it is _not_ equal to this sentinal. Since the comments in the generic kernel code indicate that the struct file will never be used for anything other than passing straight through to readpage(), this should be ok. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 74706f352780..39d03f3f2d54 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -28,6 +28,7 @@
#include "quota.h"
#include "trans.h"
#include "rgrp.h"
+#include "ops_file.h"
/**
* gfs2_get_block - Fills in a buffer head with details about a block
@@ -267,10 +268,12 @@ static int gfs2_readpage(struct file *file, struct page *page)
atomic_inc(&sdp->sd_ops_address);
- gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
- error = gfs2_glock_nq_m_atime(1, &gh);
- if (error)
- goto out_unlock;
+ if (file != &gfs2_internal_file_sentinal) {
+ gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh);
+ error = gfs2_glock_nq_m_atime(1, &gh);
+ if (error)
+ goto out_unlock;
+ }
if (gfs2_is_stuffed(ip)) {
if (!page->index) {
@@ -284,8 +287,10 @@ static int gfs2_readpage(struct file *file, struct page *page)
if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags)))
error = -EIO;
- gfs2_glock_dq_m(1, &gh);
- gfs2_holder_uninit(&gh);
+ if (file != &gfs2_internal_file_sentinal) {
+ gfs2_glock_dq_m(1, &gh);
+ gfs2_holder_uninit(&gh);
+ }
out:
return error;
out_unlock: