diff options
author | Russell Cattelan <cattelan@redhat.com> | 2006-09-18 17:26:48 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-09-18 17:26:48 -0400 |
commit | dc41aeedef6b776583064be8abe6813159b4901d (patch) | |
tree | 59a80e3c6ef693f24359b46a1e254854938b2e71 | |
parent | 7a6bbacbb8dec6fbd1242c959250388f907d429e (diff) |
[GFS2] Fix for mmap() bug in readpage
Fix for Red Hat bz 205307. Don't need to lock in readpage if
the higher level code has already grabbed the lock.
Signed-off-by: Russell Cattelan <cattelan@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
-rw-r--r-- | fs/gfs2/ops_address.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index 6f9ac5e6e3f6..25d7025e43c2 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -218,14 +218,16 @@ static int gfs2_readpage(struct file *file, struct page *page) | |||
218 | { | 218 | { |
219 | struct gfs2_inode *ip = GFS2_I(page->mapping->host); | 219 | struct gfs2_inode *ip = GFS2_I(page->mapping->host); |
220 | struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); | 220 | struct gfs2_sbd *sdp = GFS2_SB(page->mapping->host); |
221 | struct gfs2_file *gf = NULL; | ||
221 | struct gfs2_holder gh; | 222 | struct gfs2_holder gh; |
222 | int error; | 223 | int error; |
223 | int do_unlock = 0; | 224 | int do_unlock = 0; |
224 | 225 | ||
225 | if (likely(file != &gfs2_internal_file_sentinel)) { | 226 | if (likely(file != &gfs2_internal_file_sentinel)) { |
226 | if (file) { | 227 | if (file) { |
227 | struct gfs2_file *gf = file->private_data; | 228 | gf = file->private_data; |
228 | if (test_bit(GFF_EXLOCK, &gf->f_flags)) | 229 | if (test_bit(GFF_EXLOCK, &gf->f_flags)) |
230 | /* gfs2_sharewrite_nopage has grabbed the ip->i_gl already */ | ||
229 | goto skip_lock; | 231 | goto skip_lock; |
230 | } | 232 | } |
231 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|GL_AOP, &gh); | 233 | gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|GL_AOP, &gh); |
@@ -245,7 +247,8 @@ skip_lock: | |||
245 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) | 247 | if (unlikely(test_bit(SDF_SHUTDOWN, &sdp->sd_flags))) |
246 | error = -EIO; | 248 | error = -EIO; |
247 | 249 | ||
248 | if (file != &gfs2_internal_file_sentinel) { | 250 | if (gf && !test_bit(GFF_EXLOCK, &gf->f_flags) && |
251 | file != &gfs2_internal_file_sentinel) { | ||
249 | gfs2_glock_dq_m(1, &gh); | 252 | gfs2_glock_dq_m(1, &gh); |
250 | gfs2_holder_uninit(&gh); | 253 | gfs2_holder_uninit(&gh); |
251 | } | 254 | } |