diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-02-15 05:15:18 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-02-15 05:15:18 -0500 |
commit | 61a30dcb5866eb7e92796b2988ddb4c94b9f78ac (patch) | |
tree | aa27ef185437a813041aae3e9f0aa403a960db43 /fs/gfs2/ops_address.c | |
parent | 4dd651adbb4898d3200426c197b26c99d2209d8d (diff) |
[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.c | 17 |
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 @@ | |||
28 | #include "quota.h" | 28 | #include "quota.h" |
29 | #include "trans.h" | 29 | #include "trans.h" |
30 | #include "rgrp.h" | 30 | #include "rgrp.h" |
31 | #include "ops_file.h" | ||
31 | 32 | ||
32 | /** | 33 | /** |
33 | * gfs2_get_block - Fills in a buffer head with details about a block | 34 | * 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) | |||
267 | 268 | ||
268 | atomic_inc(&sdp->sd_ops_address); | 269 | atomic_inc(&sdp->sd_ops_address); |
269 | 270 | ||
270 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); | 271 | if (file != &gfs2_internal_file_sentinal) { |
271 | error = gfs2_glock_nq_m_atime(1, &gh); | 272 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, &gh); |
272 | if (error) | 273 | error = gfs2_glock_nq_m_atime(1, &gh); |
273 | goto out_unlock; | 274 | if (error) |
275 | goto out_unlock; | ||
276 | } | ||
274 | 277 | ||
275 | if (gfs2_is_stuffed(ip)) { | 278 | if (gfs2_is_stuffed(ip)) { |
276 | if (!page->index) { | 279 | if (!page->index) { |
@@ -284,8 +287,10 @@ static int gfs2_readpage(struct file *file, struct page *page) | |||
284 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 287 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
285 | error = -EIO; | 288 | error = -EIO; |
286 | 289 | ||
287 | gfs2_glock_dq_m(1, &gh); | 290 | if (file != &gfs2_internal_file_sentinal) { |
288 | gfs2_holder_uninit(&gh); | 291 | gfs2_glock_dq_m(1, &gh); |
292 | gfs2_holder_uninit(&gh); | ||
293 | } | ||
289 | out: | 294 | out: |
290 | return error; | 295 | return error; |
291 | out_unlock: | 296 | out_unlock: |