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_file.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_file.c')
-rw-r--r-- | fs/gfs2/ops_file.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c index bcde7a0b76f1..b86037832299 100644 --- a/fs/gfs2/ops_file.c +++ b/fs/gfs2/ops_file.c | |||
@@ -67,6 +67,16 @@ struct filldir_reg { | |||
67 | void *fdr_opaque; | 67 | void *fdr_opaque; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | /* | ||
71 | * Most fields left uninitialised to catch anybody who tries to | ||
72 | * use them. f_flags set to prevent file_accessed() from touching | ||
73 | * any other part of this. Its use is purely as a flag so that we | ||
74 | * know (in readpage()) whether or not do to locking. | ||
75 | */ | ||
76 | struct file gfs2_internal_file_sentinal = { | ||
77 | .f_flags = O_NOATIME|O_RDONLY, | ||
78 | }; | ||
79 | |||
70 | static int gfs2_read_actor(read_descriptor_t *desc, struct page *page, | 80 | static int gfs2_read_actor(read_descriptor_t *desc, struct page *page, |
71 | unsigned long offset, unsigned long size) | 81 | unsigned long offset, unsigned long size) |
72 | { | 82 | { |
@@ -95,7 +105,9 @@ int gfs2_internal_read(struct gfs2_inode *ip, struct file_ra_state *ra_state, | |||
95 | desc.arg.buf = buf; | 105 | desc.arg.buf = buf; |
96 | desc.count = size; | 106 | desc.count = size; |
97 | desc.error = 0; | 107 | desc.error = 0; |
98 | do_generic_mapping_read(inode->i_mapping, ra_state, NULL, pos, &desc, gfs2_read_actor); | 108 | do_generic_mapping_read(inode->i_mapping, ra_state, |
109 | &gfs2_internal_file_sentinal, pos, &desc, | ||
110 | gfs2_read_actor); | ||
99 | return desc.written ? desc.written : desc.error; | 111 | return desc.written ? desc.written : desc.error; |
100 | } | 112 | } |
101 | 113 | ||